Hi,
Have been using the same database for years without any trouble. Suddenly we are getting the Data Type Mismatch in Criteria Expression when we attempt to run a VB function.
I am not familiar with VB so much, but have found where the error is happening:
Private Sub Command1_Click()
On Error GoTo Err_Command1_Click
Dim i As Integer
Dim a As String
i = 0
Do Until i > 2
a = InputBox("Please Enter your ClientId" & vbCrLf & vbCrLf & _
" ( which is your surname followed by" & vbCrLf & _
" your security number, eg: Smith123 )", _
"ClientId?", a, 2000, 2000)
If a = "" Then Exit Sub
If (DCount("ClientID", "Client Info records", _
"ucase$(ClientId)='" & Trim$(UCase$(a)) & "'") > 0) Then i = 16
i = i + 1
Loop
If i < 16 Then
MsgBox "ClientId Rejected!" & vbCrLf & vbCrLf & _
"If you have forgotten your ClientId," & vbCrLf & _
"please see front-desk staff who can Help!" & vbCrLf & vbCrLf & _
"(Please avoid making a second new ClientId," & vbCrLf & _
" as this upsets our record-keeping!)", vbCritical, "ClientId?"
Exit Sub
End If
Dim stDocName As String
Dim stLinkCriteria As String
a = UCase$(a)
stDocName = "ClientIDprompt"
DoCmd.OpenForm stDocName, , , "ucase$(ClientId)='" & a & "'" ', , , stLinkCriteria
Exit_Command1_Click:
Exit Sub
Err_Command1_Click:
MsgBox Err.Description
Resume Exit_Command1_Click
End Sub
As I have stated this code worked fine for years and now suddenly we are getting this error.
Thanks in advance for any assistance.
mel01