Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Invalid Use Of Null on LookUp Combo Box

Status
Not open for further replies.
Mar 9, 2007
48
US
Hi all,

I've perused this forum and found some answers to my question ( thread702-1440004 and thread702-1434023 ) but I'm unsure how to apply those answers to my issue.

I have this code on an unbound combo box on a form:

Private Sub FindPatient_AfterUpdate()
FilterOn = False
Dim MyRecSet As Object
Set MyRecSet = Me.Recordset.Clone
MyRecSet.FindFirst "[Last_Name]='" & Replace(Me!FindPatient, "'", "''") & "' AND [First_Name]='" & Me!FindPatient.Column(1) & "'"
Me.Bookmark = MyRecSet.Bookmark
End Sub

This combo box is used to look up patients. The error message "invalid use of null" appears when the user leaves the combo box to update another field, click an add button, etc. The code breaks at:

MyRecSet.FindFirst "[Last_Name]='" & Replace(Me!FindPatient, "'", "''") & "' AND [First_Name]='" & Me!FindPatient.Column(1) & "'"

What gives? Your assistance is greatly appreciated.
 
Code:
Private Sub FindPatient_AfterUpdate()
If IsNull(Me!FindPatient) Then Exit Sub
...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I knew it was an easy solution...just not easy for me. Thanks PHV!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top