Looking for code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have searched the security FAQ and have been unable to find the type of
code I am looking for.

WHat I need is code that will do the following:

1) will check to see which user has loged in.
2) Depending on which user it will load a form and turn on/off toolbars and
menubars.

I will be activating the code using an AutoExec macro that runs the function
on start up. I just need help with the code. I am using Access 2003

Any help would be great, thanks
 
Daniel,

There was a similar post in April, here's the OP and my answer to it.

HTH,
Nikos


Is there a way to set criteria in an auto-exec macro that will
display a different form depending on the group that the user belongs
to? Need to display different forms for each group at startup.

Yes. Suppose you have a table called tblUsers, with a field UserName and
a field UserGroup; also a table called tblGroups, with a field UserGroup
and a field FormName (all fields type Text). Join the two tables on
field UserName in a select query like:

SELECT tblUsers.UserName, tblGroups.FormName
FROM tblGroups INNER JOIN tblUsers ON tblGroups.UserGroup =
tblUsers.UserGroup

and save it as qryUserForms. Finally, in your autoexec macro use an
OpenForm action, with the following expression in the Form Name argument:

=DLookUp("[FormName]","qryUserForms","[UserName]=CurrentUser()")

HTH,
Nikos
 
thanks for that Nikos that has been a great help

--
Daniel Staines
IAG


Nikos Yannacopoulos said:
Daniel,

There was a similar post in April, here's the OP and my answer to it.

HTH,
Nikos


Is there a way to set criteria in an auto-exec macro that will
display a different form depending on the group that the user belongs
to? Need to display different forms for each group at startup.

Yes. Suppose you have a table called tblUsers, with a field UserName and
a field UserGroup; also a table called tblGroups, with a field UserGroup
and a field FormName (all fields type Text). Join the two tables on
field UserName in a select query like:

SELECT tblUsers.UserName, tblGroups.FormName
FROM tblGroups INNER JOIN tblUsers ON tblGroups.UserGroup =
tblUsers.UserGroup

and save it as qryUserForms. Finally, in your autoexec macro use an
OpenForm action, with the following expression in the Form Name argument:

=DLookUp("[FormName]","qryUserForms","[UserName]=CurrentUser()")

HTH,
Nikos
 
Back
Top