Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding records to a table 1

Status
Not open for further replies.

jgarnick

Programmer
Feb 16, 2000
189
0
0
US
Visit site
I have a form that displays records from a table. I also have a command button to Add a Record to the table.&nbsp;&nbsp;The code behind the button is DoCmd.GoToRecord , , acNewRec.&nbsp;&nbsp;It works fine for the first record, but if I try to click the button a second time to add a second record, it gives me an error about being at the end of a recordset.&nbsp;&nbsp;What am I missing?<br><br>Thanks! <p>jgarnick<br><a href=mailto:jgarnick@aol.com>jgarnick@aol.com</a><br><a href= > </a><br>
 
Not sure, never had that problem.<br>But try saving the record before adding a new one.<br><br>Private Sub Command12_Click()<br>On Error GoTo Err_Command12_Click<br><br>&nbsp;&nbsp;&nbsp;&nbsp;DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70<br><br>End SubDoCmd.GoToRecord , , acNewRec<br><br>Exit_Command12_Click:<br>&nbsp;&nbsp;&nbsp;&nbsp;Exit Sub<br><br>Err_Command12_Click:<br>&nbsp;&nbsp;&nbsp;&nbsp;MsgBox Err.Description<br>&nbsp;&nbsp;&nbsp;&nbsp;Resume Exit_Command12_Click<br><br>This is reverse procedure I know, but if the record you just added is not saved it may be at the end of the recordset and give that error.<br>And saving a record before you add a new one won't hurt anything either.<br>&nbsp;&nbsp;&nbsp;&nbsp;<br><br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top