Handling Null value in combo box

Baldrick

Registered User.
Local time
Today, 05:20
Joined
Jul 2, 2001
Messages
35
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?
 
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
 
Sweet. Thanks RDH
 

Users who are viewing this thread

Back
Top Bottom