View Full Version : VBYesNo problem...


WinDancer
06-16-2008, 01:40 PM
Why does this code not branch when the user chooses no at the msgbox?
********************************************

Private Sub Command6_Click()

'Already A survey for this employer?
If DCount("*", "qryCheckForPreviousSurvey") > 0 Then
MsgBox "A survey for this account number already exists. Would you like to go ahead anyway?", vbYesNo
End If

If vbYesNo = vbNo Then GoTo LastLine

' tell the user that you are working
DoCmd.OpenForm "frmPreLoadWait"

******************************************
There is a line at the end of the code, just before end sub,
"LastLine :"

Thanks,
Dave

gemma-the-husky
06-16-2008, 02:32 PM
it should be

if msgbox("myquestion",vbyesno) = vbno then
'code for negative response here
end if

WinDancer
06-17-2008, 09:47 AM
That works :)
Thanks
Dave