Problem updating field based on another field

gellerche

Registered User.
Local time
Today, 17:18
Joined
Jun 19, 2001
Messages
73
I have a subform with two pertinent controls. One is a combo box that gets its values (an ID number) from the database. The other is a text box that uses DLookUp to compare the ID in the dropdown to the ID in a table, and then return the name associated with that ID. This DLookUp is in the Control Source property of the text box. So far, this works. The form uses the subform, and the subform displays each ID and its respective names in a Detail section.

The problem is in the last part of the subform. This is a blank Detail so the user can enter another ID. Since the ID dropdown is blank, the text box doesn't have anything to look for, so it displays "#Error". What I would like is for the text box to be blank if the combo box is blank.

I've tried:
If IsNull(cboID) Then
txtName.Value = ""
End If

in the Form_Load, Open, Activate, and Current events, but the text box still says "#Error". If anyone has any ideas, I would appreciate the help.

Thank you,

Steve Geller
 
Why not just add the name field to the combo, add an unbound textbox and set its control source to =[MyCombo].[Column](1)
 
Rich:

Genius. Absolute genius. Thank you so much for pointing me to a simple answer, especially when I was wasting my time trying to do it the complicated way.

Steve Geller
 

Users who are viewing this thread

Back
Top Bottom