DLookUp

Haytham

Registered User.
Local time
Today, 13:57
Joined
Jun 27, 2001
Messages
162
Hi All..
I have a combo box getting Bill No (Number Field) from a table, and another UnBound Control to display the name of the person having this Bill.
In ControlSource of UnBound:
=DLookUp("[tCustomerName]","tblSaleMain","[tBillNo]=" & [txtBillNo] & "")

When I select the Bill No, it gives the right name.. but when Bill No is empty it gives # Error
Where is the error
:mad: :mad: :confused: :eek: :( :o :mad: :mad:
 
it is because [txtBillNo] is null.

If you are using a combo, there is an easier (and quicker) way to get the name. In the recordsource supplying the combo, add the persons name into the query grid.

In the combo, make this column hidden so eg
Combo fields

Fields: BillID, BillNo, PersonName
Widths: 0;;0

in the textbox you currently have the Dlookup, use
=Forms!NameOfForm!NameOfCombo.column(2)

this will then display the name of any selection in the combo. If it is null, so will be the name display field.
 
Perfect Answer

Hi Fizzio,
Really it's a pefect answer and it's a new thing to learn in Access.
Everyday, I respect Access more and more and of course our programmers...
Very thankful to you Fizzio:D :D :D
 

Users who are viewing this thread

Back
Top Bottom