Message Box

G

Guest

Hi,

Wondering if anyone out there might be able to please help with a question
regarding a message box ?

I have a form that requires user input. I have a button that the user
clicks when they are finished to then Save the form. What I want to do is
havea message box pop-up when the user clicks the button, that says something
like "Any editions cannot be changed, are you sure you want to save ?" And
the Message box to have a YES NO choice - the YES saves the form, the NO goes
back to make more changes.

Sounds simple, but all I can manage to do is make a Message Box macro that
displays a message with the only choice being an OK button to dismiss the
message - No yes or no choices ...

Any ideas would be very much appreciated.

Thanks,

Sonja.
 
S

strive4peace

Test Msgbox Button
---

Hi Sonja,

'~~~~~~~~~~~~
select case MsgBox( _
"Additions cannot be changed, are you sure you want to save ?" _
, vbYesNo _
, "Continue with Save?")
case vbYes
'statements
case vbNo
'statements
end select
'~~~~~~~~~~~~~

I realize that I gave you VBA code and you mentioned "macro" -- hollar
if you need more help :)

if you want the Default to be No and not Yes, you can use
'vbYesNo + vbCefaultButton2' instead of 'vbYesNo' for the second
argument of MsgBox

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
G

Guest

Hi Strive4peace :)

Thanks SO much for your help !

I tried pasting your code into the code builder - is the following correct ?

Private Sub MsgBox_Click()
Select Case MsgBox( _
"Additions cannot be changed, Are you sure you want to save ?" _
, vbYesNo _
, "Continue with Save?")
Case vbYes
'statements
Case vbNo
'statements
End Select

End Sub

It gives me an error "Run time error '438'
Object doesn't support this property or method

When I hit debug, the code builder comes up with the following text
highlighted:
Select Case MsgBox( _
"Additions cannot be changed, Are you sure you want to save ?" _
, vbYesNo _
, "Continue with Save?")


Thanks again for your help - it is really appreciated :)

Sonja.
 
S

strive4peace

you're welcome, Sonja

do not NAME your control "MsgBox" ... obviously, it is a reserved word

You cannot use function names, property names, etc for YOUR names...

try changing the name of the control to something like cmdMessage

Problem names and reserved words in Access, Allen Browne
http://www.allenbrowne.com/AppIssueBadWord.html

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
S

strive4peace

you're welcome, Sonja ;) happy to help

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top