My form is used for entering records.
When a user clicks a button to submit one, I want a pop-up box to load up
saying "Would you like to enter another record?" with Yes or No options
listed below. If yes, a new blank record loads up, if no, the form closes.
How can I do this? (I am a bit of an Access novice so if you could be basic
in your answer - i.e. where to place code, etc. that would be great)
Thanks!
If MsgBox("Would you like to enter another record?", vbQuestion +
vbYesNo) = vbYes Then
Docmd.GotoRecord acNewRec
Else
Docmd.Close acForm, Me.Name, acSaveNo
End If

Signature
Dave Hargis, Microsoft Access MVP
> My form is used for entering records.
>
[quoted text clipped - 6 lines]
>
> Thanks!
rye1982 - 18 Jul 2008 14:52 GMT
Thank you very much.
Where/how do I input this code into Access 2007?
I am getting a "can't parse the expression" error when I input it into the
code into the Expression Builder for my button.
Could you explain the naming of each portion of the code as well? (ie. what
should me.Name be in my database?)
Ryan
> If MsgBox("Would you like to enter another record?", vbQuestion +
> vbYesNo) = vbYes Then
[quoted text clipped - 13 lines]
> >
> > Thanks!
Klatuu - 18 Jul 2008 15:03 GMT
It goes in the code builder.

Signature
Dave Hargis, Microsoft Access MVP
> Thank you very much.
> Where/how do I input this code into Access 2007?
[quoted text clipped - 22 lines]
> > >
> > > Thanks!
rye1982 - 18 Jul 2008 17:08 GMT
I am getting a "can't parse the expression" error when I input it into the
code into the Expression Builder for my button. What could be causing this?
Could you explain the naming of each portion of the code as well? (ie. what
should me.Name be in my database?)
> It goes in the code builder.
>
[quoted text clipped - 24 lines]
> > > >
> > > > Thanks!
Klatuu - 18 Jul 2008 18:59 GMT
It goes in the Code Builder, Not the expression builder.
In the properties dialog for the command button click event, delete whatever
you have in the On Click event text box.
Click the small button with 3 dots next to the text box.
Select Code Builder
Paste the code in there.
The code needs no change, Me.Name returns the name of the form as a string.

Signature
Dave Hargis, Microsoft Access MVP
> I am getting a "can't parse the expression" error when I input it into the
> code into the Expression Builder for my button. What could be causing this?
[quoted text clipped - 29 lines]
> > > > >
> > > > > Thanks!