populate information that has already been entered.

G

Guest

Currently I am trying to create a form that after I enter like an employee ID
number the rest of the employees information would fill in. If the employee
has not yet been entered into this database it would leave everything blank
to be filled in by the user. Is it possible to have the fields populate with
already entered information
 
J

Jeff Boyce

That depends...

Are you looking to have the pre-existing information displayed, or are you
trying to replicate the pre-existing data? If the latter, let me be the
first to suggest that you DON'T!

If the former, let me suggest that there are alternatives to forcing your
user to enter an ID number. You could use an unbound combo box to allow the
user to select an employee by name, and, after selection, display that
employee's information on the form (basically, you are "looking up" an
employee's record for display/editing/whatever).

If the user enters a name not already in the employees table, your combo box
can use the NotInList event to pop up a form to allow the new employee to be
entered.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
G

Guest

Jeff, Thanks for your quick response.

I am looking to have pre-existing information displayed. Ultimately this
database is going to contain many different employees so it would be easier
to type in like the employee id number instead of trying to find the
employee's name in like a drop-down box. Is it possible to type in the id
and then maybe after hitting the tab button the rest of the information will
be prefilled.
 
J

Jeff Boyce

Absolutely.

Again, though, let me recommend that you use a combo box and have the user
"pick" one from the list. Actually, since a combo box can "auto-complete",
you could use either a name or an ID number.

Create a query that returns the employee information. Create a form that
displays that.

Add a combo box (not bound to any field) that uses a query that returns IDs
(?and names).

Modify the query to include a criterion. Make that selection criterion
"point" to the form, to the combo box (you're saying "find me the record
where the ID = what's in the combo box). The selection criterion will look
something like:

Forms!YourFormName!YourComboBoxName

Finally, in the combo box's AfterUpdate event, you'll requery the form, with
something like:

Me.Requery

Since the form is based on a query that uses the combo box's value as a
selection criterion, and since you've just selected a value from the combo
box, the form will "load" with that record.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
L

louonline

You should take Jeff's advise and make the user "pick from a list'
otherwise you leave a big margin for error. What happens in the user
type-in the wrong ID? ; Either you get the wrong name or a blank and
you risk filling in details for a name that already exists with a
differnt ID.

Lou
 

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