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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COMBO BOX NULL ERROR

Status
Not open for further replies.

penndro

Technical User
Jan 9, 2005
108
US
I could use some help tightening up the following code:

Private Sub Combo114_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[InterviewID] = " & Str(Me![Combo114])
Me.Bookmark = rs.Bookmark
End Sub

It runs fine - BUT - if the use clears out the combo box then it gives and error:

RUN TIME ERROR '94'
Invalid use of NULL

How can I fix this and also how can I CLEAR COMBO BOX after record comes up?

 
Hi,

Use the following:

rs.FindFirst "[InterviewID] = " & nz (Str(Me![Combo114]), "")

Andrew
 
OR

Private Sub Combo114_AfterUpdate()
' Find the record that matches the control.
if isnull(combo114) exit sub
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[InterviewID] = " & Str(Me![Combo114])
Me.Bookmark = rs.Bookmark
End Sub


PS - i dont know if there are other dependancies, but you may want to set rs=nothing before the end of the sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top