2 Questions

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

Aurora

I am using Access 2000

1. I created a form with a field for "EmpID". I made
this field a drop down list so employees only have to
click on a button and pick out their ID#. But I want to
lock this field so that once the field has data and the
record is saved it can not be changed. I tried locking
the field, but then I can not even enter data into a blank
field. Can't change the field (which is what I want), but
can not enter a new record either. What am I doing wrong?

2. Is there a way to add a "name" field based on
the "EmpID". Meaning someone picks out their ID#, and the
name field automatically puts in the correct name?

Aurora
 
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.
 

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

Back
Top