HELP!!!

  • Thread starter Thread starter BEN CURREY
  • Start date Start date
B

BEN CURREY

I have costructed a database which contains a number of
tables, forms, queries and modules. However, i am utterly
stuck on this one!!!

I have a form, on which the first field is a name entry
box. once this is entered in the second box i want it to
produce a the phone number of that person, by looking it
up in the table of names and numbers. i have defined the
table key to be the name, but cant seem to get it to work.
any help would be greatly appreciated.

Many Thanks

Ben
 
Ben,

You need to set the controlsource of the second textbox to something like:

DLookup("[fldPhone]","tblPhones","[fldName]= ' " & Me.txtName & " ' "

(change the table, fields and textbox names to the actuals).

Then you need to use the On Change venet of the first textbox (Name) to run
a macro or some code to Requery the second textbox.

Also, use the On Current event of the form to fire the same macro or query,
so your pnone control is refreshed while scrolling through records.

HTH,
Nikos
 
Back
Top