View Full Version : Handling Null value in combo box


Baldrick
12-19-2001, 10:37 AM
I have the follwoing in the AfterUpdate event of my combo box

Sub cboFind_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[Atten_ID] = " & Me![cboFind]
Me.Bookmark = Me.RecordsetClone.Bookmark

End Sub

if a user changes their mind and dletes a name selected in the combo and then tabs out of the combo, they get a runtime error.

Do I need to specify a default value?

R. Hicks
12-19-2001, 11:10 AM
Alter your SubRoutine to what I have below. This should fix your problem.

Sub cboFind_AfterUpdate()
' If the Combo Is Empty .... do nothing
If IsNull(Me![cboFind]) Then Exit Sub

' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[Atten_ID] = " & Me![cboFind]
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub

HTH
RDH

Baldrick
12-19-2001, 11:20 AM
Sweet. Thanks RDH

R. Hicks
12-19-2001, 11:50 AM
Great .... :-)

Glad it fixed the problem.

RDH