Auto Populate

C

CJ

Hi,

Could someone please explain in very basic terms of how to auto populate a
field in a table.

I would like to enter a user ID and the address, name ect comes up
automatically.

Many thanks
 
A

Al Campagna

CJ,
Well, very basically, try using a combo (bound to the ID field)
to select the ID.
But, as a genereally accepted rule, don't re-capture all
the other ancillary information, like Address, City, etc. Just "display" it
on the form.
Since you capture the ID, you can always rederive the ancillary
information
"on the fly" in any subsequent form, query,or report.
That combo might display just ID and Name, but also have columns for
Address, City, State, etc...
After a selection is made you can display all the ancillary info with
calculated controls.
Given these combo (ex. cboID) columns...
ID Name Address City ... etc....
A text control iwth a ControlSource of...
= cboID.Column(2)
will always display the Address value from the combo.
(Combo cols are numbered left to right... 0,1,2,3,4,etc)
=cboID.Column(3)
would display the City value, and so on and so on.
--
hth
Al Campagna
Microsoft Access MVP 2007-2009
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
J

John W. Vinson

Hi,

Could someone please explain in very basic terms of how to auto populate a
field in a table.

I would like to enter a user ID and the address, name ect comes up
automatically.

Many thanks


You don't!

Relational databases use the "Grandmother's Pantry Principle": "A place - ONE
place! - for everything, everything in its place".

The user's name, address, and so on should be stored in the User table and
*noplace else*. Storing it redundantly in a second table wastes space, and
more importantly makes it possible to have inconsistant data: you could have a
user with one address in the user table, and a different address in this
second table.

The second table should have ONLY the UserID; if you need to see that table's
data in conjunction with user biographical data, you can use a Query joining
the tables, or a Form to *display* (but not store) the user data. To do the
latter include the address, name, etc. in the combo's rowsource query, and put
textboxes on the form with control sources like

=comboboxname.Column(n)

where n is the zero-based position of the column you want to see.
 

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