Hi,
I am new to building a database and need some help.
I have a form that when a certain item is selected in a drop down box, a new form opens and pre-populates some of the data for the user. With our current personnel structure though, I only want 1 designated person to use the option in the field that opens the new form, so I am creating a message box to remind people. What I want is if someone answers "yes" to the message box than the next form opens. However if they answer "no" I want the entry they just made to clear, and the subsequent form to not open. I am stuck at the form always opens whether they answer yes or no.
Code:
Private Sub Order_Response_AfterUpdate()
Dim Response As Integer
If Me.Order_Response.Value = "NOI" Then
MsgBox "The option of 'NOI' should only be used by Keri, are you Keri?", vbYesNo, "Warning"
IfResponse = vbYesThen
DoCmd.OpenForm "f_NOI"
Forms!f_NOI.txt_lo_name = Me.txt_13260_Owner_1
Forms!f_NOI.txt_lo_addr = Me.txt_13260_Address
Forms!f_NOI.txt_lo_city = Me.txt_13260_City
Forms!f_NOI.txt_lo_st = Me.txt_13260_State
Forms!f_NOI.txt_lo_zip = Me.txt_13260_Zip
Forms!f_NOI.txt_APN = Me.txt_key_apn
Forms!f_NOI.txt_acres = Me.txt_acres
Forms!f_NOI.SUBMIT_DATE = Me.txt_Response_Date
Else 'Do nothing
Cancel
End If
End Sub
I am new to building a database and need some help.
I have a form that when a certain item is selected in a drop down box, a new form opens and pre-populates some of the data for the user. With our current personnel structure though, I only want 1 designated person to use the option in the field that opens the new form, so I am creating a message box to remind people. What I want is if someone answers "yes" to the message box than the next form opens. However if they answer "no" I want the entry they just made to clear, and the subsequent form to not open. I am stuck at the form always opens whether they answer yes or no.
Code:
Private Sub Order_Response_AfterUpdate()
Dim Response As Integer
If Me.Order_Response.Value = "NOI" Then
MsgBox "The option of 'NOI' should only be used by Keri, are you Keri?", vbYesNo, "Warning"
IfResponse = vbYesThen
DoCmd.OpenForm "f_NOI"
Forms!f_NOI.txt_lo_name = Me.txt_13260_Owner_1
Forms!f_NOI.txt_lo_addr = Me.txt_13260_Address
Forms!f_NOI.txt_lo_city = Me.txt_13260_City
Forms!f_NOI.txt_lo_st = Me.txt_13260_State
Forms!f_NOI.txt_lo_zip = Me.txt_13260_Zip
Forms!f_NOI.txt_APN = Me.txt_key_apn
Forms!f_NOI.txt_acres = Me.txt_acres
Forms!f_NOI.SUBMIT_DATE = Me.txt_Response_Date
Else 'Do nothing
Cancel
End If
End Sub