Autopopulating fields on a form based on the entry in the first field?

J

John Shanley

Hi,

I'm working on a database and I have a question.

I have two tables, one (Table 1) that contains peoples details, while the
second (Table 2) contains potentially multiple entries for each person.

I have a form to enter the information for Table 2. People have an ID number
that is on both tables. I want to be able to automatically have Access fill
in the Name, Address and Contact Number fields when the ID number is
entered. Is this possible? I am convinced that it is, but I've been wrong
before!!!

Do I have to run a query using the text entered in the ID field in order for
it to fill in the required information? Or am I miles away from the mark???

Any and all help will be greatly appreciated.
 
J

Jeff C

John said:
Hi,

I'm working on a database and I have a question.

I have two tables, one (Table 1) that contains peoples details, while the
second (Table 2) contains potentially multiple entries for each person.

I have a form to enter the information for Table 2. People have an ID number
that is on both tables. I want to be able to automatically have Access fill
in the Name, Address and Contact Number fields when the ID number is
entered. Is this possible? I am convinced that it is, but I've been wrong
before!!!

Do I have to run a query using the text entered in the ID field in order for
it to fill in the required information? Or am I miles away from the mark???

Any and all help will be greatly appreciated.

Hi John.

Name, address and Contact Number are unique records in Table 1? Then you
would not need to fill them in on form 2. If they are unique, they
should not be duplicated in other tables.

Use a button from Form1 to open form 2 and set it to acNew
On the OnClick event - add:
Forms![fm_Form2]![int_ContactNum] = Forms![fm_Form1]![int_ContactNum]

The second form will then open from the button and go to the relevant
ContactNo.

The second way is to add a subformControl and make form2 the source.
Then link them child and master using the same 'int_ContactNum'. Then,
as you go through the records on Form1, the subform will automatically
change.

Hope this helps,

jeff C
 

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

Top