Automatic Fill In

  • Thread starter Thread starter Aurora
  • Start date Start date
A

Aurora

I am using Access 2000
I have a form with two fields (lookup from a table with
the same two fields); "empID" and "empname". Is it
possible to click on an empID in one field and have the
corresponding name automatically come in the empname field.
If so, can you please help me?

aurora
 
As posted last time you submitted this question...


If it were me, I'd add a "find number" field to the header section of my
form. I'd put code in the field's on exit event to find the matching record
and pull it to the form. You could then simply lock the employee number
field in the actual detail section of the form.

If you want to do it the way you have it, you would have to create code in
the "current" event to test and see if a value exists. If so, lock the
field, if not, unlock it. There is also a test you can do that would simply
say, if this is a new record" then unlock the field.

To populate the name, you'd have to include the name as one of the columns
in your drop-down and put it in the name field on your form.

Use option one if you want the person to pull up an existing record from the
table and make changes to it.

Use option two if you are building related records and you want to prefill
some of the data so the links will be correct.

Post back if you have questions, but let us know which of these two options
you are using changing an existing record, or adding related data in another
table.
 
Aurora:

Rather than posting your questions when you run across them, you should look
at previous posts to see if a similar question has been asked. I use Google
Groups for my searches.

Here is a link that includes about 100 previous posts related to a "search
field" on a form. One of the more common answers is to use the combo-box
wizard and tell it you want it to find a particular record. The wizard will
do the rest for you.



http://groups-beta.google.com/group...ublic.access.forms+"search+field"&qt_s=Search
 
Back
Top