Macro to open specific form based on access level

G

Guest

I have a macro which opens a form based on the username and password that the
user enters on a Login form. After the user enters their name and password,
I would like to have a specific form open based on the users level. In the
user table I have fields UserName, Password, Level. Within level I have 1,2,
and 3. I want Level 1 to open form Level 1, Level 2 to open form Level 2,
etc.

My macro is this so far:
[UserName]=DLookUp("[UserName]","tblUsers") And
[Password]=DLookUp("[Password]","tblUsers")

Any help is greatly appreciated.
 
T

tina

presumably you're verifying the UserName/Password combination immediately
after it is entered in the Login form. since you may want to control access
to various forms and functions in the user interface, i wouldn't repeatedly
check the UserName/Password at each "point of entry".

instead, suggest you add an unbound textbox control to your Login form. set
the control's Visible property to False. when you verify the
UserName/Password, set the value of the textbox to the user's Level, from
the user table. then leave the Login form open, and set the form's Visible
property to False. now the current user's Level is available to you as long
as the database remains open.

in your macro, you can set a condition to check the Level and open the
appropriate form, as

Condtion: Forms!LoginFormName!LevelControlName = 1
Action: OpenForm
Form Name: Level1FormName
Condition: Forms!LoginFormName!LevelControlName = 2
Action: OpenForm
Form Name: Level2FormName

substitute the correct names of the forms and the textbox control, of
course.

hth
 
G

Guest

May I run another scenario by you.

When the user opens the switchboard and selects a certain menu, I would like
all the information on that menu to filter to the users "region". For
example: The menu contains items for forms and reports. User 1 has access
to the South/Central region and User 2 has access to the Western and Eastern
regions. Can the password form hold the filter information for all the items
in the switchboard?

tina said:
presumably you're verifying the UserName/Password combination immediately
after it is entered in the Login form. since you may want to control access
to various forms and functions in the user interface, i wouldn't repeatedly
check the UserName/Password at each "point of entry".

instead, suggest you add an unbound textbox control to your Login form. set
the control's Visible property to False. when you verify the
UserName/Password, set the value of the textbox to the user's Level, from
the user table. then leave the Login form open, and set the form's Visible
property to False. now the current user's Level is available to you as long
as the database remains open.

in your macro, you can set a condition to check the Level and open the
appropriate form, as

Condtion: Forms!LoginFormName!LevelControlName = 1
Action: OpenForm
Form Name: Level1FormName
Condition: Forms!LoginFormName!LevelControlName = 2
Action: OpenForm
Form Name: Level2FormName

substitute the correct names of the forms and the textbox control, of
course.

hth


Karen said:
I have a macro which opens a form based on the username and password that the
user enters on a Login form. After the user enters their name and password,
I would like to have a specific form open based on the users level. In the
user table I have fields UserName, Password, Level. Within level I have 1,2,
and 3. I want Level 1 to open form Level 1, Level 2 to open form Level 2,
etc.

My macro is this so far:
[UserName]=DLookUp("[UserName]","tblUsers") And
[Password]=DLookUp("[Password]","tblUsers")

Any help is greatly appreciated.
 
T

tina

doesn't really matter if you need a bit of data from the user table, about
the current user, for reference during the current session - or twenty bits
of data. just handle it the same way i described previously, adding an
additional unbound textbox to the login form, for each additional value that
you need to reference elsewhere in the user interface.

hth


Karen said:
May I run another scenario by you.

When the user opens the switchboard and selects a certain menu, I would like
all the information on that menu to filter to the users "region". For
example: The menu contains items for forms and reports. User 1 has access
to the South/Central region and User 2 has access to the Western and Eastern
regions. Can the password form hold the filter information for all the items
in the switchboard?

tina said:
presumably you're verifying the UserName/Password combination immediately
after it is entered in the Login form. since you may want to control access
to various forms and functions in the user interface, i wouldn't repeatedly
check the UserName/Password at each "point of entry".

instead, suggest you add an unbound textbox control to your Login form. set
the control's Visible property to False. when you verify the
UserName/Password, set the value of the textbox to the user's Level, from
the user table. then leave the Login form open, and set the form's Visible
property to False. now the current user's Level is available to you as long
as the database remains open.

in your macro, you can set a condition to check the Level and open the
appropriate form, as

Condtion: Forms!LoginFormName!LevelControlName = 1
Action: OpenForm
Form Name: Level1FormName
Condition: Forms!LoginFormName!LevelControlName = 2
Action: OpenForm
Form Name: Level2FormName

substitute the correct names of the forms and the textbox control, of
course.

hth


Karen said:
I have a macro which opens a form based on the username and password
that
the
user enters on a Login form. After the user enters their name and password,
I would like to have a specific form open based on the users level.
In
the
user table I have fields UserName, Password, Level. Within level I
have
1,2,
and 3. I want Level 1 to open form Level 1, Level 2 to open form Level 2,
etc.

My macro is this so far:
[UserName]=DLookUp("[UserName]","tblUsers") And
[Password]=DLookUp("[Password]","tblUsers")

Any help is greatly appreciated.
 
G

Guest

How do I set the value? I am trying to set the value of the unbound text box
called AccessType on my Login form with the value from the users table. I
receive a message "The object doesn't contain the automation object
'tblUsers'.

tina said:
doesn't really matter if you need a bit of data from the user table, about
the current user, for reference during the current session - or twenty bits
of data. just handle it the same way i described previously, adding an
additional unbound textbox to the login form, for each additional value that
you need to reference elsewhere in the user interface.

hth


Karen said:
May I run another scenario by you.

When the user opens the switchboard and selects a certain menu, I would like
all the information on that menu to filter to the users "region". For
example: The menu contains items for forms and reports. User 1 has access
to the South/Central region and User 2 has access to the Western and Eastern
regions. Can the password form hold the filter information for all the items
in the switchboard?

tina said:
presumably you're verifying the UserName/Password combination immediately
after it is entered in the Login form. since you may want to control access
to various forms and functions in the user interface, i wouldn't repeatedly
check the UserName/Password at each "point of entry".

instead, suggest you add an unbound textbox control to your Login form. set
the control's Visible property to False. when you verify the
UserName/Password, set the value of the textbox to the user's Level, from
the user table. then leave the Login form open, and set the form's Visible
property to False. now the current user's Level is available to you as long
as the database remains open.

in your macro, you can set a condition to check the Level and open the
appropriate form, as

Condtion: Forms!LoginFormName!LevelControlName = 1
Action: OpenForm
Form Name: Level1FormName
Condition: Forms!LoginFormName!LevelControlName = 2
Action: OpenForm
Form Name: Level2FormName

substitute the correct names of the forms and the textbox control, of
course.

hth


I have a macro which opens a form based on the username and password that
the
user enters on a Login form. After the user enters their name and
password,
I would like to have a specific form open based on the users level. In
the
user table I have fields UserName, Password, Level. Within level I have
1,2,
and 3. I want Level 1 to open form Level 1, Level 2 to open form Level 2,
etc.

My macro is this so far:
[UserName]=DLookUp("[UserName]","tblUsers") And
[Password]=DLookUp("[Password]","tblUsers")

Any help is greatly appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top