Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reports in acces

Status
Not open for further replies.

alifyag

MIS
Apr 15, 2002
18
US
hello,
i have a form switchboard where when the user types his user name and passowrd, i store the NAME of that user in a variable called pname which i have declared as a public variable in the bas utilities.
now when this user prints a report i want the NAME of this user to get displayed in the report header.
i created a text box on the report and tried to call the variable pname to display the users name but without any luck....maybe my code is wrong....
please let me know my mistake...or is there any other way to solve the problem.
alifya
 
Where are you placing the code? Which event? On the form or on the report? petersdaniel@hotmail.com
"If A equals success, then the formula is: A=X+Y+Z. X is work. Y is play. Z is keep your mouth shut." --Albert Einstein

 
In the Control Source of the text box type in:
= CurrentUser()
This will print out the userid of the user currently logged on...
 
In the report insert a text box ie textbox1. In the event procedure, on format, set textbox = pname. You cannot call the variable from the textbox.

Thats it.

Note: currentuser() will always display Admin if you are not Access's logon screen. nordycki@hotmail.com
 
hello everyone. thanks for your replies.
Nordyck...your answer worked.
thanks
alifya
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top