By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,248 Members | 1,979 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,248 IT Pros & Developers. It's quick & easy.

auto populate field in a form by entering data into another field

P: 2
Hi there

Firstly, please note: I am a green user and do not know anything about MS Access.

I have a simple access database where I have a table which stores biographical data about staff members.
(I have various other tables which store various other data - but they are not the problem.....yet)

I created a separate form where I have various fields which will hold other details.
In this same form, I want be able to type in a staff member's ID number, and have his first name and surname auto populated into the first name and surname fields.
In other words, I do not want to have to type in the first name and surname again; I want the first name and surname that relates to the ID number I typed in, to be auto populated into the fields.
The first name and surname will be fetched from a table called "Tbl_Contact_Details"

How do I do this in the simplest way?

Thank you
Jun 21 '17 #1

✓ answered by NeoPa

Some people swear by AutoNumbers. Others, not so much. They certainly offer some good things in as much as you don't need to enter them yourself, but they are long way from being necessary IMO. That's not to say don't use them, but it is to say don't feel that's the only option available. Bear in mind how much space (Bytes) your PK takes though, as within indexing the size really does matter. The smaller the better.

As far as your original question goes I think the easiest answer is to have your Form with a .RecordSource of a query built by linking the two tables together into an updatable query. That way the data you want will be available automatically without any need to do anything complicated.

Share this Question
Share on Google+
5 Replies


Nauticalgent
P: 89
Are you using this form to Edit and/or Add contact information? If so there are things to consider before answering this question. Also, is it safe to assume that the ID number is a PK field and also a AutoNumber?
Jun 21 '17 #2

P: 2
Hi

I am using the form to add more information about the staff member.

Yes, the ID number is a PK field; it is not an autoNumber - it is text field.

I used the "text" data type, as I thought the "number" data type was only used for numbers when calculations are involved.

Should the data type actually be a number field?
Jun 21 '17 #3

Nauticalgent
P: 89
making the PK field an AutoNumber field is ALWAYS a good practice to get into...one that will make things easier as your application evolves.

As far as your situation goes, you could place a combobox in the header of your form that will allow you to select a contact and them filter your form accordingly. Access has a wizard that works fairly well to do just this...
Jun 21 '17 #4

PhilOfWalton
Expert 100+
P: 1,430
This may help



It is a basic form for a member (Staff).

Note the Combo box at the bottom used to select a member of staff.

Phil
Jun 21 '17 #5

NeoPa
Expert Mod 15k+
P: 31,419
Some people swear by AutoNumbers. Others, not so much. They certainly offer some good things in as much as you don't need to enter them yourself, but they are long way from being necessary IMO. That's not to say don't use them, but it is to say don't feel that's the only option available. Bear in mind how much space (Bytes) your PK takes though, as within indexing the size really does matter. The smaller the better.

As far as your original question goes I think the easiest answer is to have your Form with a .RecordSource of a query built by linking the two tables together into an updatable query. That way the data you want will be available automatically without any need to do anything complicated.
Jun 21 '17 #6

Post your reply

Sign in to post your reply or Sign up for a free account.