p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

access thread: how do I save the current record and go to a new one


Message #1 by "Carl Schwarcz" <carl@s...> on Mon, 18 Jun 2001 16:29:23 -0700
I've got a form with an unbound button that I want to save the current

record and go to a new record.  I've tried the following code, but get

the messages that the commands are not available.  Any suggestions?



Private Sub btnSaveAndNew_Click()



    ' Save the current record



    'DoCmd.RunCommand acCmdSaveRecord



    



    ' create new record



    DoCmd.RunCommand acCmdRecordsGoToNew



End Sub



Ps: I would have tried DoCmd.DoMenuItem but the help files says it is

obsolete.





------=_NextPart_000_0041_01C0F813.D5769780

Content-Type: text/html;

	charset="US-ASCII"

Content-Transfer-Encoding: quoted-printable



<html>



<head>

<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =

charset=3Dus-ascii">





<meta name=3DGenerator content=3D"Microsoft Word 10 (filtered)">

<title> </title>



<style>

<!--

 /* Font Definitions */

 @font-face

	{font-family:"Century Schoolbook";

	panose-1:2 4 6 3 5 5 5 2 3 3;}

@font-face

	{font-family:"Trebuchet MS";

	panose-1:2 11 6 3 2 2 2 2 2 4;}

 /* Style Definitions */

 p.MsoNormal, li.MsoNormal, div.MsoNormal

	{margin-top:0in;

	margin-right:0in;

	margin-bottom:6.0pt;

	margin-left:0in;

	font-size:11.0pt;

	font-family:"Century Schoolbook";}

h1

	{margin-top:12.0pt;

	margin-right:0in;

	margin-bottom:6.0pt;

	margin-left:0in;

	text-align:center;

	page-break-after:avoid;

	font-size:14.0pt;

	font-family:"Century Schoolbook";

	font-weight:bold;}

h2

	{margin-top:12.0pt;

	margin-right:0in;

	margin-bottom:6.0pt;

	margin-left:0in;

	text-align:center;

	page-break-after:avoid;

	font-size:14.0pt;

	font-family:"Century Schoolbook";

	font-weight:bold;}

h3

	{margin-top:12.0pt;

	margin-right:0in;

	margin-bottom:6.0pt;

	margin-left:0in;

	text-align:center;

	page-break-after:avoid;

	font-size:12.0pt;

	font-family:"Century Schoolbook";

	font-weight:bold;}

p.MsoCaption, li.MsoCaption, div.MsoCaption

	{margin-top:6.0pt;

	margin-right:0in;

	margin-bottom:6.0pt;

	margin-left:0in;

	font-size:10.0pt;

	font-family:"Century Schoolbook";

	font-weight:bold;}

a:link, span.MsoHyperlink

	{color:#0066CC;

	text-decoration:underline;}

a:visited, span.MsoHyperlinkFollowed

	{color:purple;

	text-decoration:underline;}

p.MsoPlainText, li.MsoPlainText, div.MsoPlainText

	{margin-top:0in;

	margin-right:0in;

	margin-bottom:6.0pt;

	margin-left:0in;

	font-size:11.0pt;

	font-family:"Courier New";}

p

	{margin-top:0in;

	margin-right:0in;

	margin-bottom:6.0pt;

	margin-left:0in;

	font-size:12.0pt;

	font-family:"Times New Roman";}

p.descript, li.descript, div.descript

	{margin-top:0in;

	margin-right:0in;

	margin-bottom:6.0pt;

	margin-left:.5in;

	font-size:11.0pt;

	font-family:"Trebuchet MS";

	color:black;}

span.EmailStyle18

	{font-family:Arial;

	color:windowtext;}

p.bullet, li.bullet, div.bullet

	{margin-top:0in;

	margin-right:0in;

	margin-bottom:6.0pt;

	margin-left:.75in;

	text-indent:-.25in;

	font-size:11.0pt;

	font-family:"Century Schoolbook";}

p.person, li.person, div.person

	{margin-top:0in;

	margin-right:0in;

	margin-bottom:6.0pt;

	margin-left:0in;

	text-align:center;

	font-size:12.0pt;

	font-family:"Century Schoolbook";

	font-weight:bold;}

@page Section1

	{size:8.5in 11.0in;

	margin:1.0in 1.25in 1.0in 1.25in;}

div.Section1

	{page:Section1;}

 /* List Definitions */

 ol

	{margin-bottom:0in;}

ul

	{margin-bottom:0in;}

-->

</style>



</head>



<body lang=3DEN-US link=3D"#0066CC" vlink=3Dpurple>



<div class=3DSection1>



<p class=3DMsoNormal><font size=3D2 face=3DArial><span =

style=3D'font-size:10.0pt;

font-family:Arial'>I’ve got a form with an unbound button that I =

want to

save the current record and go to a new record.  I’ve tried =

the following

code, but get the messages that the commands are not available.  =

Any

suggestions?</span></font></p>



<p class=3DMsoNormal><font size=3D2 face=3DArial><span =

style=3D'font-size:10.0pt;

font-family:Arial'>Private Sub btnSaveAndNew_Click()</span></font></p>



<p class=3DMsoNormal><font size=3D2 face=3DArial><span =

style=3D'font-size:10.0pt;

font-family:Arial'>    ' Save the current =

record</span></font></p>



<p class=3DMsoNormal><font size=3D2 face=3DArial><span =

style=3D'font-size:10.0pt;

font-family:Arial'>    'DoCmd.RunCommand =

acCmdSaveRecord</span></font></p>



<p class=3DMsoNormal><font size=3D2 face=3DArial><span =

style=3D'font-size:10.0pt;

font-family:Arial'>    </span></font></p>



<p class=3DMsoNormal><font size=3D2 face=3DArial><span =

style=3D'font-size:10.0pt;

font-family:Arial'>    ' create new =

record</span></font></p>



<p class=3DMsoNormal><font size=3D2 face=3DArial><span =

style=3D'font-size:10.0pt;

font-family:Arial'>    DoCmd.RunCommand =

acCmdRecordsGoToNew</span></font></p>



<p class=3DMsoNormal><font size=3D2 face=3DArial><span =

style=3D'font-size:10.0pt;

font-family:Arial'>End Sub</span></font></p>



<p class=3DMsoNormal><font size=3D2 face=3D"Century Schoolbook"><span

style=3D'font-size:11.0pt'>Ps: I would have tried DoCmd.DoMenuItem but =

the help

files says it is obsolete.</span></font></p>



</div>



</body>



</html>

Message #2 by "John Ruff" <papparuff@c...> on Mon, 18 Jun 2001 18:17:42 -0700
Carl,



What is the form's RecordSource set to?





John Ruff - The Eternal Optimist :)

 -----Original Message-----

From: 	Carl Schwarcz [mailto:carl@s...] 

Sent:	Monday, June 18, 2001 4:29 PM

To:	Access

Subject:	[access] how do I save the current record and go to a new one



I've got a form with an unbound button that I want to save the current

record and go to a new record.  I've tried the following code, but get

the messages that the commands are not available.  Any suggestions?

Message #3 by Miriam Engelberg <MiriamE@c...> on Mon, 18 Jun 2001 16:54:03 -0700
Try this code instead:



    DoCmd.GoToRecord , , acNewRec



Miriam Engelberg

Technology Faculty/Chief Cartoonist

CompassPoint Nonprofit Services

www.compasspoint.org

(xxx) xxx-xxxx





-----Original Message-----

From: Carl Schwarcz [mailto:carl@s...]

Sent: Monday, June 18, 2001 4:29 PM

To: Access

Subject: [access] how do I save the current record and go to a new one





I've got a form with an unbound button that I want to save the current

record and go to a new record.  I've tried the following code, but get

the messages that the commands are not available.  Any suggestions?



Private Sub btnSaveAndNew_Click()



    ' Save the current record



    'DoCmd.RunCommand acCmdSaveRecord



    



    ' create new record



    DoCmd.RunCommand acCmdRecordsGoToNew



End Sub



Ps: I would have tried DoCmd.DoMenuItem but the help files says it is

obsolete.



Message #4 by "Levine, Lloyd" <LEVINLL@m...> on Tue, 19 Jun 2001 08:15:15 -0400
Are you using Access 2000 ?



-----Original Message-----

From: Carl Schwarcz [mailto:carl@s...]

Sent: Monday, June 18, 2001 7:29 PM

To: Access

Subject: [access] how do I save the current record and go to a new one





I've got a form with an unbound button that I want to save the current

record and go to a new record.  I've tried the following code, but get

the messages that the commands are not available.  Any suggestions?



Private Sub btnSaveAndNew_Click()



    ' Save the current record



    'DoCmd.RunCommand acCmdSaveRecord



    



    ' create new record



    DoCmd.RunCommand acCmdRecordsGoToNew



End Sub



Ps: I would have tried DoCmd.DoMenuItem but the help files says it is

obsolete.

Message #5 by "Carl Schwarcz" <carl@s...> on Tue, 19 Jun 2001 07:43:42 -0700
The recordsource of the form is set to a table



-----Original Message-----

From: John Ruff [mailto:papparuff@c...] 

Sent: Monday, June 18, 2001 6:18 PM

To: Access

Subject: [access] RE: how do I save the current record and go to a new

one



Carl,



What is the form's RecordSource set to?





John Ruff - The Eternal Optimist :)
Message #6 by "Carl Schwarcz" <carl@s...> on Tue, 19 Jun 2001 07:44:53 -0700
I did this and it works.  However I'm still puzzled as to why

DoCMD.RunCommand didn't work.



------------------------------------------------------





-----Original Message-----

From: Miriam Engelberg [mailto:MiriamE@c...] 

Sent: Monday, June 18, 2001 4:54 PM

To: Access

Subject: [access] RE: how do I save the current record and go to a new

one



Try this code instead:



    DoCmd.GoToRecord , , acNewRec



Miriam Engelberg

Technology Faculty/Chief Cartoonist

CompassPoint Nonprofit Services

www.compasspoint.org

(xxx) xxx-xxxx



Message #7 by "Carl Schwarcz" <carl@s...> on Tue, 19 Jun 2001 07:45:20 -0700
I'm using Access from Office XP



------------------------------------------------------

Carl W. Schwarcz







-----Original Message-----

From: Levine, Lloyd [mailto:LEVINLL@m...] 

Sent: Tuesday, June 19, 2001 5:15 AM

To: Access

Subject: [access] RE: how do I save the current record and go to a new

one



Are you using Access 2000 ?


  Return to Index