Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box to populate unbound box

Status
Not open for further replies.

MrMcFestoe

Technical User
Apr 6, 2003
119
0
0
GB
Hi

I have a combox bow on a form, which gets all my customers account numbers from a table, want iam trying to do is when the combo box selects a customer the name and address in automatically filled in the address box,

Thanks
 
You should be able to use DLookup to get this information.

Set the controlsource of the unbound control to:

DLookup("SourceTable","SourceField","CustomerID = " & Forms!FormName!ComboBox)

James Goodman MCSE, MCDBA
 
Thanks

For the quite reply, i have tried

=DLookUp("Customer","Add 1","Customer ID = " & [Forms]![Invoice]![ComboBox])

and iam getting the dreeded #Error

any ideas
 
I keep getting this the wrong way round today!

Should be

DLookup(expr, domain, [criteria])
Where
Argument Description
expr An expression that identifies the field whose value you want to return. It can be a string expression identifying a field in a table or query, or it can be an expression that performs a calculation on data in that field. In expr, you can include the name of a field in a table, a control on a form, a constant, or a function. If expr includes a function, it can be either built-in or user-defined, but not another domain aggregate or SQL aggregate function.
domain A string expression identifying the set of records that constitutes the domain. It can be a table name or a query name for a query that does not require a parameter.
criteria An optional string expression used to restrict the range of data on which the DLookup function is performed. For example, criteria is often equivalent to the WHERE clause in an SQL expression, without the word WHERE. If criteria is omitted, the DLookup function evaluates expr against the entire domain. Any field that is included in criteria must also be a field in domain; otherwise, the DLookup function returns a Null.



James Goodman MCSE, MCDBA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top