G
Graham
I'm trying to control what happens after the user clicks on 'Yes' or 'No' but
without joy. Code is as follows
sMsg = "You are about to DELETE the Financial Record" _
& vbCrLf & " associated with this Contact." _
& vbCrLf & vbCrLf & "Do you wish to continue?"
bResponse = MsgBox(sMsg, vbYesNo + vbCritical)
MsgBox (bResponse)
' If bResponse = True _
If bResponse = vbYes _
Then
MsgBox "then"
sSQL = "DELETE tcFinancial.*, tcFinancial.ContactID " _
& "FROM tcFinancial " _
& "WHERE (((tcFinancial.ContactID)= " & fiContactID & "
));"
DoCmd.SetWarnings False
DoCmd.RunSQL sSQL
DoCmd.SetWarnings True
sfContacts2.Form.Requery
Else
MsgBox "else"
Cancel = True
Me.cbEnqID.Undo
End If
The value of bResponse for both Yes and No buttons is True so if I test for
that, it is always the Then condition that is processed, whereas if I test
for vbYes, it is always the Else that is processed.
Must be simple but it beats me.
Access 2002
without joy. Code is as follows
sMsg = "You are about to DELETE the Financial Record" _
& vbCrLf & " associated with this Contact." _
& vbCrLf & vbCrLf & "Do you wish to continue?"
bResponse = MsgBox(sMsg, vbYesNo + vbCritical)
MsgBox (bResponse)
' If bResponse = True _
If bResponse = vbYes _
Then
MsgBox "then"
sSQL = "DELETE tcFinancial.*, tcFinancial.ContactID " _
& "FROM tcFinancial " _
& "WHERE (((tcFinancial.ContactID)= " & fiContactID & "
));"
DoCmd.SetWarnings False
DoCmd.RunSQL sSQL
DoCmd.SetWarnings True
sfContacts2.Form.Requery
Else
MsgBox "else"
Cancel = True
Me.cbEnqID.Undo
End If
The value of bResponse for both Yes and No buttons is True so if I test for
that, it is always the Then condition that is processed, whereas if I test
for vbYes, it is always the Else that is processed.
Must be simple but it beats me.
Access 2002