General discussion

Locked

BeforeInsert to repeat employee name

By rcoleman ·
I enter data in a form called Customers which is based on a table of the same name (Customers) and a table called Employee's. Instead of using the shortcut key every time to enter the employee's name that entered the data (Ctrl + ') I would like itto be automatic. When an employee fills out their first sale of the day and enters their name from a combo box that is set to "Limit to List", this name would become the default until changed by another selection from the drop down list. Please give me an example of how this code might be written. And if I understand it right, there would need to be a BeforeInsert event procedure and an AfterInsert event procedure, right? If you could recommend a book that would help me with questions of this sort that would be helpful too. Thanks!

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

BeforeInsert to repeat employee name

by Firefox In reply to BeforeInsert to repeat e ...

Are you using Microsoft Access? If you are, I think you are making this too complicated. Why not just put a password on the Admin login name for the database and use the employee's login name for the default value where you want it?
To give a password to user Admin in Access97, go to Tools, Security, User and Group Accounts, Change Logon Password, and enter in the New Password (& Verify).
Then add a username for each employee (they don't need to have passwords).
Now go into the details of the field you want the user's name to go and use
=CurrentUser()
for the Default Value.

From now on, the user will enter his username when opening up the database and that username will automatically show up where you told it to. There is no need to mess with BeforeInsert and AfterInsert details.

Make sure each employee logs out of the database when they are done, so the next user can enter his name.

If you want to get fancy, you could even create a form that opens up first, which would ask for the user's name. Then you could point to that form field in the Default value of the data entry area. When a new employee comes along, they could just enter their name on that form, without even logging out of the database.

Other people may have more ideas for you too, if you really want to make the drop-down list box work the way you want.

Collapse -

BeforeInsert to repeat employee name

by rcoleman In reply to BeforeInsert to repeat e ...

Poster rated this answer

Collapse -

BeforeInsert to repeat employee name

by rcoleman In reply to BeforeInsert to repeat e ...

Yes I am using Access 97 and will be upgrading to Access 2000. Am still experimenting with your suggestion (CurrentUser) and waiting to see what comes in, but yours is certianly worth some thought! Thanks.

Collapse -

BeforeInsert to repeat employee name

by rcoleman In reply to BeforeInsert to repeat e ...

This question was closed by the author

Back to Software Forum
4 total posts (Page 1 of 1)  

Related Discussions

Related Forums