Data lookup in Access

  • Thread starter Thread starter Antony
  • Start date Start date
A

Antony

Hi Guys,

I am trying to create a Dlookup, that takes the fax number, from the table
Company, based on a drop down box (or written text box) in the form stock,
called Company Name. The code below works to the extent that the form must
be saved first, then when updated it works ok, but I would like it to update
automatically, and am not sure why it isn't working.

=DLookUp("[Fax Number]","[company]",("[Company Name]=Form.[Company Name]"))

Also, are there any programs that will compile access files into .exe's?

Many thanks

Antony
 
Antony said:
Hi Guys,

I am trying to create a Dlookup, that takes the fax number, from the table
Company, based on a drop down box (or written text box) in the form stock,
called Company Name. The code below works to the extent that the form must
be saved first, then when updated it works ok, but I would like it to update
automatically, and am not sure why it isn't working.

=DLookUp("[Fax Number]","[company]",("[Company Name]=Form.[Company
Name]"))

"[Company Name]= '" & Me![Company Name] & "'"

However a better way to do this would be to join the Company table to the
Stock form and use a query for the form and not write code.

If you have a lot of companies then sooner or later you will find that you
don't have enough fields for phone numbers.
A companyPhones table with PhoneID , CompanyID, PhoneType, and PhoneNumber
would be much better.
You could then drop a subform on the form and show all the phones for the
company.
MainLine, Backline, Faxlines, homephone, cellphone, etc.

In the old days before pagers and then cell phons became popular this list
at your friendly answering service would also include girlfriend(s) phones.
 
Back
Top