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
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