Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Buttons in MsgBox 2

Status
Not open for further replies.

BT24

Programmer
Aug 19, 2002
76
CA
Hi
This is the code that i have written and when i hit the Ok button or the cancel button they both do the same thing and when i hit the ok button the form opens but goes to the background. could someone please help

Private Sub Maintenance_Click()
MsgBox ("Email Todd Harvey About the Problem With the Truck"), vbOKCancel
If "1" Then
DoCmd.OpenForm ("frmToddEmail"), acNormal
End If
If "2" Then
DoCmd.OpenForm ("frmTruckSheet"), acNormal
End If
End Sub

thanks for the help
IAMUSELESS
 
Try this...

Private Sub Maintenance_Click()
if MsgBox ("Email Todd Harvey About the Problem With the Truck", vbOKCancel) = vbOK then
DoCmd.OpenForm ("frmToddEmail"), acNormal
else
DoCmd.OpenForm ("frmTruckSheet"), acNormal
End If
End Sub
junior1544@jmjpc.net
Life is change. To deny change is to deny life.
 
Try this



Dim strMsg As String, res As String
strMsg = "Email Todd Harvey About the Problem With the Truck"
If MsgBox(strMsg, vbOKCancel, "Give Me 2 stars") = vbOK Then
'DoCmd.OpenForm ("frmToddEmail"), acNormal
res = MsgBox("You Pressed OK", vbOKOnly, "FYI")
Else
'DoCmd.OpenForm ("frmToddEmail"), acNormal
res = MsgBox("You Pressed CANCEL", vbOKOnly, "FYI")
End If



test it with the message box, then, if it works, comment them out and uncomment the open form commands.

David
I'm Your Huckleberry!
 
Thanks For all your help Folks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top