What am I doing wrong: DLookUp

T

TanyaM

I want to have the WorkPhone from my company table display (not available to
edit) in my contacts form (Contacts form is based on contacts table).

So in an unbound box I have the following control source:

=DLookUp("[Company]![WorkPhone]","[Company]","[Company]![CompanyID] =
Forms![CompanyName]")

It doesn't seem to be working. What am I doing wrong?

Thanks,
Tanya
 
D

Douglas J. Steele

Forms![CompanyName] is incorrect. The syntax is
Forms![NameOfForm]![NameOfControl]

Also, remove the [Company]! from in front of [WorkPhone] and [CompanyID]
 
D

Damon Heron

For one thing, you are comparing an ID with a name. Have you tried:

=DLookUp("WorkPhone","Company","CompanyID = " & [CompanyID])

Damon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

DLookup in Continuous form 0
QBF & Query Malfunction 0
General Question on a database setup. 19
one-to-many Print problem 2
DLOOKUP 2
Linking forms/tables 4
DLookup Function 2
combo box based on filter 8

Top