J
Jeff M
I use the following code to locate the appropriate record
based on user input. I changed the data type from number
to text for the CustID field of all associated tables so
that I could use the input mask to limit user input to !
00000000.0;0;" ". Now I am getting a "Data Type Mismatch
in Criteria Expression" error. I assume that it is due to
the criteria in the code below, but I don't know how to
fix this.
Private Sub FindCustID_Click()
On Error GoTo Err_FindCustID_Click
Dim stDocName As String
Dim count As Variant
Dim stLinkCriteria As String
stDocName = "CustDetailsTableInputFormUPDATE"
count = DCount("[Cust ID]", "CustDetailsTable", "[Cust
ID]=" & Me![Text3])
stLinkCriteria = "[Cust ID]=" & Me![Text3]
If count = 1 Then
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Maximize
DoCmd.Close acForm, "Switchboard"
DoCmd.Close acForm, "FindCustID"
ElseIf count = 0 Then
DoCmd.OpenForm "IDDoesNotExist"
Me.Text3.SetFocus
End If
Exit_FindCustID_Click:
Exit Sub
Err_FindCustID_Click:
MsgBox Err.Description
Resume Exit_FindCustID_Click
End Sub
based on user input. I changed the data type from number
to text for the CustID field of all associated tables so
that I could use the input mask to limit user input to !
00000000.0;0;" ". Now I am getting a "Data Type Mismatch
in Criteria Expression" error. I assume that it is due to
the criteria in the code below, but I don't know how to
fix this.
Private Sub FindCustID_Click()
On Error GoTo Err_FindCustID_Click
Dim stDocName As String
Dim count As Variant
Dim stLinkCriteria As String
stDocName = "CustDetailsTableInputFormUPDATE"
count = DCount("[Cust ID]", "CustDetailsTable", "[Cust
ID]=" & Me![Text3])
stLinkCriteria = "[Cust ID]=" & Me![Text3]
If count = 1 Then
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Maximize
DoCmd.Close acForm, "Switchboard"
DoCmd.Close acForm, "FindCustID"
ElseIf count = 0 Then
DoCmd.OpenForm "IDDoesNotExist"
Me.Text3.SetFocus
End If
Exit_FindCustID_Click:
Exit Sub
Err_FindCustID_Click:
MsgBox Err.Description
Resume Exit_FindCustID_Click
End Sub