I don't know how your table is set up since you have not defined your table structure or your object/control names. You will have to tweak this to suit you.
This is quick and dirty, untested, and not as complete as I would do it.
1) Make a table called Users that holds the info of UserID and Name.
Two fields:
UserID (text)
UserName (text)
Fill it with data (6 records). I assume you are using Windows OS and you have user ID's you have to log in with every day. Put those ID's into the UserID field.
2) Add a new field (UserID) in your existing table. Write update query to fill this field with UserID's of each person from the table you just made. When you are done you can delete the UserName field from your existing table.
3) in your database window, go to the Modules tab and hit NEW. Paste in this:
Code:
Function GetUserID()
GetUserID = Environ("Username")
End Function
3) In the same code window, paste in this:
Code:
Function OpenMainForm()
'This opens the main form for the current user
DoCmd.OpenForm "FormNameHere", acNormal,,"UserID = '" & GetUserID & "'"
End Function
4) File+Save and save this module, doesn't matter what you name it.
5) Make a new macro. make it's only command be
RunCode + OpenMainForm()
Close the macro and name it Autoexec. That way it will run when the db is launched.
6) On your current form change the text box for the UserName field to be for UserID. Make it's default setting be
=GetUserID()
this way the person's user ID will always just plunk in there.
These are only bits of a bigger picture. Depending on how your db is set up, you will have to tweak things and fool around to make it all work. Give it a shot and let us know how it goes.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at