Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / July 2008

Tip: Looking for answers? Try searching our database.

Yes / No Message Box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rye1982 - 17 Jul 2008 20:52 GMT
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!
Klatuu - 17 Jul 2008 21:41 GMT
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!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.