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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro At Startup

Status
Not open for further replies.

tomco22

Technical User
Sep 16, 2000
74
US
I want my autoexec macro to write the user name and date to a table whenever the database is opened. I fine-tuned the code with a click event:
Code:
Private Sub User_Click()
...irrelevant code
txtUser = fOSUserName
txtDate = Now()
...irrelevant code
End Sub
The click event works great but I want to automate the issue so it fires in the background without the user's knowledge. I put the code in a (non click) Sub Procedure but I can't figure out how to call or execute the Sub Procedure from the macro. Help appreciated.

Tom

tomco22
 
Hi,
Put the code on open event of the startup form. Make sure this form will open only once when the user run the application, otherwise user will get the message everytime he opens the form.

Regards

Zameer
 
Zameer,

I had considered putting the code in the open event but I chose not to because I thought it might generate multiple entries if the user went in and out of the form. After reading your post I re-visited the idea and decided that you are right. The open event would be the simplest way to fire this code. Thanks for the help.

tomco22
I Nab Terrorists
 
Zameer,

I did put the code in the open event and it works great. Thank you for your help.

tomco22
I Nab Terrorists
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top