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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbYesNo Question

Status
Not open for further replies.

Hayton

Technical User
Oct 17, 2001
257
NZ
Hello Everyone,

When I run this code it gives me a 'type mismatch'. Not too sure what that means. Can any give some pointers


Private Sub lblUpdate_Click()
On Error GoTo Err_lblUpdate_Click

Dim stDocName As String

MsgBox "Are you sure that you need to use the UPDATE option", vbYesNo, "REPORT UOPDATE!"

If MsgBox("Are you sure that you need to use the UPDATE option", vbYesNo, "REPORT UOPDATE!" = vbNo) Then
Exit Sub
Else
stDocName = "UpdateSalesData"
DoCmd.RunMacro stDocName
End If


stDocName = "UpdateSalesData"
DoCmd.RunMacro stDocName

Exit_lblUpdate_Click:
Exit Sub

Err_lblUpdate_Click:
MsgBox Err.Description
Resume Exit_lblUpdate_Click
End Sub

Hayton McGregor

 
Hi!

Try dropping off the first message box, and alter the second to something like this:

[tt]If MsgBox("Are you sure that you need to use the UPDATE option", vbYesNo, "REPORT UOPDATE!")= vbNo Then[/tt]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top