Open a form and go to the first empty record

  • Thread starter Thread starter RockNRoll
  • Start date Start date
R

RockNRoll

Greetings,

Background:
I have a sales forecast sheet and I have a button that I want users to click
if they need to enter a new program. Right now, when I click the button, it
just goes to the first record. I want it to go to the first empty record so
users can enter in a new program.

Question:
I am looking for code that will open up a form and go to the first empty
record for entry.

Thank you kindly,
-Dave
 
Dave, the coding I use for adding a new record is:
****************
Sub control_Click()
On Error GoTo Err_control_Click

DoCmd.GoToRecord , , acNewRec

Exit_control_Click:
Exit Sub

Err_control_Click:
MsgBox Err.Description
Resume Exit_control_Click

End Sub

****************
Where control is the name of the button or other control
you might associate the adding a new record to.

Hope this helps.
*** John
 
I am looking for code that will open up a form and go to the first empty
record for entry.

Try:

DoCmd.GoToRecord acNewRecord

in the VBA code of the button's click event.
 
Perfect. Thank you both.

JohnE said:
Dave, the coding I use for adding a new record is:
****************
Sub control_Click()
On Error GoTo Err_control_Click

DoCmd.GoToRecord , , acNewRec

Exit_control_Click:
Exit Sub

Err_control_Click:
MsgBox Err.Description
Resume Exit_control_Click

End Sub

****************
Where control is the name of the button or other control
you might associate the adding a new record to.

Hope this helps.
*** John
 
Back
Top