unbound textbox

kingsgambit

Registered User.
Local time
Today, 09:47
Joined
May 27, 2001
Messages
134
I am building a database for salespersons, each salesperson would have the database on there laptop. When they run the database they can enter there name which is stored in a table. I would like all reports to put there name on them, how do I get the report to pull the username from the table
 
Do you have Access security implemented? If so, you can use some code like this to easily get the username of the person logged in, then pull up their full name from another user name table somewhere in the database:
Sub GetUserName()
Dim usr As DAO.User
   Set usr = DBEngine.Workspaces(0).Users(CurrentUser())
   strUsername = usr.Name
End Sub

If you don't have security, you can create a simple log on form where the salesperson can select their name from a combo box. Or you can simply have your report prompt the salesperson to select their name from a form each time they print out the report.
 
I don't have security, but the idea is that each salesperson, would have there own copy of the database on there laptop, so there would not be any other user enteredjust there own name.
I just wanted the reports to automatically pull the data from the Usertable and put it into a textbox on the report
 
OK, so somewhere along the line, the user needs to input their name so the computer can idenitfy who they are.

You'll either have to do that at some point when the program is running (startup time is a good choice) or prompt them for their name the first time a report is run. Pick one of those and we can point you in the right direction.
 
It would good if when the user first runs the database it prompts for a username or open a form for the user to fillin.
Is it possible for a macro to check to see if there is a username so the form would not open again if there was a name in the table?
 

Users who are viewing this thread

Back
Top Bottom