Coding to set a text box's recordsource

cstanley

Registered User.
Local time
Today, 00:43
Joined
May 20, 2002
Messages
86
Hello all,

I have a combo box called "cbobuildingcodes" and a text box called "Description". The value in the Description text box is dlookup'ed based on the value for the combo box. This works fine. However, I'd like some error-checking code in there so when the combo box is empty, I don't get an error message in the text box.

So, I put the following in the After Update property of the combo box:

Private Sub cbobuildingcodes_AfterUpdate()
If IsNull(cbobuildingcodes) Then
Me![Description] = ""
Else
Me![Description] = DLookup("[Description]", "tblBuildingCodes", "[BuildingCode] =" & [Forms]![frmSystemInformation]![cbobuildingcodes])
End If

But all that it gives me is a blank box - it doesn't even do the dlookup anymore... what am I doing wrong?

Thanks,

Chris
 
Sorry - this is a different problem with the same database.... not trying to clutter the board
 

Users who are viewing this thread

Back
Top Bottom