Good afternoon, I have a form and in the OnOpen I have a procedure which I have used several times in the past, so I tried to modify this form and suddenly I am getting a Not Defined Compile Error with Response hi-lited. Here is the code:
Private Sub Form_Open(Cancel As Integer)
Dim myMemberNo As String
Response = MsgBox("Would You Like to Issue a New Member.", vbYesNo + vbDefaultButton2, "New?")
If Response = vbYes Then
DoCmd.GoToRecord , , acNewRec
Forms!frmAddresses!FirstName.SetFocus
DoCmd.Maximize
ElseIf Response = vbNo Then
myMemberNo = InputBox(Prompt:="What is the Member No?")
If myMemberNo = Empty Then
MsgBox Prompt:="You Did NOT Enter a Member No."
DoCmd.Close
Else
Me.RecordsetClone.FindFirst "[AddressID] = '" & myMemberNo & "'"
If Me.RecordsetClone.NoMatch Then
MsgBox "Couldn't Find Member No." & myMemberNo
DoCmd.Close
Else
Me.Bookmark = Me.RecordsetClone.Bookmark
DoCmd.Maximize
End If
End If
End If
End Sub
I have used this successfully in a half dozen other forms, but I can not see what is wrong here, any suggestions? Thank you in advance for any assistance.
Private Sub Form_Open(Cancel As Integer)
Dim myMemberNo As String
Response = MsgBox("Would You Like to Issue a New Member.", vbYesNo + vbDefaultButton2, "New?")
If Response = vbYes Then
DoCmd.GoToRecord , , acNewRec
Forms!frmAddresses!FirstName.SetFocus
DoCmd.Maximize
ElseIf Response = vbNo Then
myMemberNo = InputBox(Prompt:="What is the Member No?")
If myMemberNo = Empty Then
MsgBox Prompt:="You Did NOT Enter a Member No."
DoCmd.Close
Else
Me.RecordsetClone.FindFirst "[AddressID] = '" & myMemberNo & "'"
If Me.RecordsetClone.NoMatch Then
MsgBox "Couldn't Find Member No." & myMemberNo
DoCmd.Close
Else
Me.Bookmark = Me.RecordsetClone.Bookmark
DoCmd.Maximize
End If
End If
End If
End Sub
I have used this successfully in a half dozen other forms, but I can not see what is wrong here, any suggestions? Thank you in advance for any assistance.