Want to use Message boxes, but forgot

ox0069

Registered User.
Local time
Today, 02:11
Joined
Sep 14, 2004
Messages
11
Ok, so here is my question to all of you: I want to use a message box to determin if the user wants to continue entering data or closing the form. whow would i do that and what is the code to do it.

Thanks
Russ
 
first you need to decide where would you like to place the code. As regards code you can try something similar to the following:

Code:
If Msgbox("Continue entering data", vbYesNo) = vbYes Then
'put the code you want to continue inputting data
Else
DoCmd.Close acForm, "FormName"
End If
 
Thanks, but now i'm getting an error stating that "the value you entered is't valid for this field".

Here is the code I have so far, I don't think I'm doing any thing wrong, but I haven't been working with vb as much as I would like to.

rivate Sub Command4_Click()
On Error GoTo Err_Command4_Click

[Report #] = Text2
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
If MsgBox("Continue entering data", vbYesNo) = vbYes Then
DoCmd.GoToRecord , , acNewRec
Equipment.SetFocus
Else
DoCmd.Close
[Forms]![Record of Weapons]!Save.SetFocus
End If
Exit_Command4_Click:
Exit Sub

Err_Command4_Click:
MsgBox Err.Description
Resume Exit_Command4_Click

End Sub
 
Disregard the last post. I figured it out after I posted the reply


Thanks for allyour help though
 

Users who are viewing this thread

Back
Top Bottom