Problem with DLookup in Access 2007

wllsth

Registered User.
Local time
Today, 09:37
Joined
Sep 17, 2008
Messages
81
Whats wrong with the following syntax:-
=DLookup("[Billing Rate]", "Employees", "[ID] = ""cboEmployee.(column(2)")

which is the Control Source for a field on my current sub-form.

I am trying to lookup the value of 'Billing Rate' in 'Employees'(Table) where 'ID" = the current entry in column 2 of my Combo Box ?????
 
Along with that great reference, it is important to note that you are creating a WHERE clause string when specifying the criteria for DLookup() to use when it goes to request data from the database engine ... so ... your DLookup() syntax should probably be like this ....

{Assuming ID is a numeric value}
=DLookup("[Billing Rate]", "Employees", "[ID] = " & cboEmployee.column(1))

But if this is for a control source expression, Access will do some manipulating of the property so it would look like this ....

=DLookup("[Billing Rate]", "Employees", "[ID] = " & [cboEmployee].[column](1))

... Also, I want to re-inforce that the .Column property of a combo box is ZERO based, so Column(0) returns the value from the first column (whether its visible - column width of 0 - or not)
 

Users who are viewing this thread

Back
Top Bottom