J
Jeff
Q1: Below is the code for a pop-up where the user inputs
an ID to open an update form to a specific record in the
underlying table. How do I create an error pop-up for
invalid ID input where the ID is not listed on the table?
I tried an "If Then Else" statement as detailed below, but
it didn't work.
Original Code:
Private Sub FindCustID2_Click()
On Error GoTo Err_FindCustID2_Click
Dim stDocName1 As String
Dim stLinkCriteria As String
stDocName = "CustDetailsTableInputFormUPDATE"
stLinkCriteria = "[CUST ID]=" & Me![Text3]
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Maximize
DoCmd.Close acForm, "Switchboard"
DoCmd.Close acForm, "FindCustID"
Exit_FindCustID2_Click:
Exit Sub
Err_FindCustID2_Click:
MsgBox Err.Description
End Sub
If Then Else Code:
Private Sub FindCustID2_Click()
On Error GoTo Err_FindCustID2_Click
Dim stDocName1 As String
Dim stLinkCriteria As String
stDocName = "CustDetailsTableInputFormUPDATE"
If stLinkCriteria = "[STUDY ID]=" & Me![Text3] Then
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Maximize
DoCmd.Close acForm, "Switchboard"
DoCmd.Close acForm, "FindStudyID"
ElseIf stLinkCriteria = "[STUDY ID]<>" & Me![Text3]
Then
DoCmd.Restore
DoCmd.Close acForm, "FindStudyID"
End If
End If
Exit_FindCustID2_Click:
Exit Sub
Err_FindCustID2_Click:
MsgBox Err.Description
End Sub
Q2: I was able to set the input mask to !00000000.0;0;" "
to insure the correct input type, although I am not crazy
about the error message for invalid value input as follows:
"The value you entered isn't appropriate for the input
mask !00000000.0;0;" " specified for this field."
Can I change this to a custom message reading
simply "Invalid Format"?
Thank you in advance for your assistance!!!
Jeff
an ID to open an update form to a specific record in the
underlying table. How do I create an error pop-up for
invalid ID input where the ID is not listed on the table?
I tried an "If Then Else" statement as detailed below, but
it didn't work.
Original Code:
Private Sub FindCustID2_Click()
On Error GoTo Err_FindCustID2_Click
Dim stDocName1 As String
Dim stLinkCriteria As String
stDocName = "CustDetailsTableInputFormUPDATE"
stLinkCriteria = "[CUST ID]=" & Me![Text3]
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Maximize
DoCmd.Close acForm, "Switchboard"
DoCmd.Close acForm, "FindCustID"
Exit_FindCustID2_Click:
Exit Sub
Err_FindCustID2_Click:
MsgBox Err.Description
End Sub
If Then Else Code:
Private Sub FindCustID2_Click()
On Error GoTo Err_FindCustID2_Click
Dim stDocName1 As String
Dim stLinkCriteria As String
stDocName = "CustDetailsTableInputFormUPDATE"
If stLinkCriteria = "[STUDY ID]=" & Me![Text3] Then
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Maximize
DoCmd.Close acForm, "Switchboard"
DoCmd.Close acForm, "FindStudyID"
ElseIf stLinkCriteria = "[STUDY ID]<>" & Me![Text3]
Then
DoCmd.Restore
DoCmd.Close acForm, "FindStudyID"
End If
End If
Exit_FindCustID2_Click:
Exit Sub
Err_FindCustID2_Click:
MsgBox Err.Description
End Sub
Q2: I was able to set the input mask to !00000000.0;0;" "
to insure the correct input type, although I am not crazy
about the error message for invalid value input as follows:
"The value you entered isn't appropriate for the input
mask !00000000.0;0;" " specified for this field."
Can I change this to a custom message reading
simply "Invalid Format"?
Thank you in advance for your assistance!!!
Jeff