P
pokdbz
I recently changed a field from a number to text. The field is ScreenID. I
have this search here that worked when ScreenID was a number. But when I
changed the field to text it gave a type missmatch. How do I change it so
that it works if ScreenID is text.
Dim subjectnum As String
If IsNull(txtSearchNum.Value) Or (DLookup("[ScreenID]",
"Patient_Registry", "([ScreenID]=" & txtSearchNum.Value & ") AND
([StudyTitle]='" & cboSearch2.Value & "')")) <> 0 Then 'Exit Sub
subjectnum = DLookup("[ScreenID]", "Patient_Registry",
"([ScreenID]=" & txtSearchNum.Value & ") AND ([StudyTitle]='" &
cboSearch2.Value & "')")
Me.Filter = "[ScreenID] = " & subjectnum
Me.FilterOn = True
Me.Refresh
txtSearch.Value = 1
AddPatient.Caption = "Save Patient's Information"
Sex.SetFocus
Else
MsgBox "Screen ID and Study Title number not found."
End If
have this search here that worked when ScreenID was a number. But when I
changed the field to text it gave a type missmatch. How do I change it so
that it works if ScreenID is text.
Dim subjectnum As String
If IsNull(txtSearchNum.Value) Or (DLookup("[ScreenID]",
"Patient_Registry", "([ScreenID]=" & txtSearchNum.Value & ") AND
([StudyTitle]='" & cboSearch2.Value & "')")) <> 0 Then 'Exit Sub
subjectnum = DLookup("[ScreenID]", "Patient_Registry",
"([ScreenID]=" & txtSearchNum.Value & ") AND ([StudyTitle]='" &
cboSearch2.Value & "')")
Me.Filter = "[ScreenID] = " & subjectnum
Me.FilterOn = True
Me.Refresh
txtSearch.Value = 1
AddPatient.Caption = "Save Patient's Information"
Sex.SetFocus
Else
MsgBox "Screen ID and Study Title number not found."
End If