Yes / No Message Box

  • Thread starter Thread starter rye1982
  • Start date Start date
R

rye1982

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
 
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
 
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, 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.
 
Back
Top