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!

Autoexec Macro not working

Status
Not open for further replies.

Sadukar

Technical User
Feb 19, 2003
159
IE
Hi All

I want an autoexec macro to open a particular form depending on who logs in. This is what I have:

Function StartUp()

If CurrentUser= "John" Then
DoCmd.OpenForm "Johnsform"
ElseIf CurrentUser= "Mike") Then
DoCmd.OpenForm "mikesform"
End If
End Function

Needless to say it does not work. What am I doing wrong?

Thanks for the help.
S.
 
Hi Sadukar,

Exactly what is your problem? Does the AutoExec not start or is the function not running properly. Did you name a macro AutoExec and call your Startup function from it?

There is also a "lost" bracket in your code after your elseif after "Mike" but I suppose it is a typo.

Let us know what exactly happens,

Nath
 
Thanks Nath

After looking more closely at my code I realised that there was a typo in the user name that I was trying to reference.
Works perfect now.

Sorry about the unnecessary post and thanks for responding.

S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top