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