Multiple forms as menus

Stuart Green

Registered User.
Local time
Today, 09:23
Joined
Jun 24, 2002
Messages
108
I have created several forms to use as opening menus with different options on each. What I want to do is have a specific "menu" open at startup depending on who logs in. eg" welcome to fred's menu" if Fred logs in or "welcome to Jo's menu" if Jo logs in. I have tried having a blank form as the startup form with a macro attached to the onopen event that opens one of the other menu forms using the CurrentUser command in the macro criteria but I can't seem to get the syntax right
eg currentuser=fred open form1, currentuser=jo open form2 etc.
Am I going about this the wrong way please
 
The syntax is CurrentUser() = "username" However this only applies if you have set up a secure workgroup. If not, the CurrentUser() function returns the default user account "Admin"


David
 
Thanks DJN. In the end I got around it by using a table with the user name on it and yes/no option boxes to select the start menu. I don't know if I am showing people how to suck eggs but I did the following
Create a table with fields USERNAME, MENU1, MENU2 etc Menu1 and menu 2 should be yes/no fields. Make USERNAME the primary key so there are no duplicates
Call the table something like tbl_menu_select

Create a query on this table. In the field USERNAME put the criteria CurrentUser()

Create a simple form based on this query (use the wizard if you want)
Call this frm_menu_select. When you open this form now it will only open for the one record in the tbl_menu_select for the logged on user

Create your menus (frm_menu_one, frm_menu_two etc)

Create a macro. In the criteria you need something like

Condition action form
[menu1]=-1 close frm_menu_select
[menu1]=-1 open frm_menu_one
[menu2]=-1 close frm_menu_select
[menu2]=-1 open frm_menu_two

This will close the filter form and open the menu one if option one is ticked or menu two if option 2 ticked in the table tbl_menu_select. Of course it will get confused if more than one option ticked so…don’t tick more than one option!

Now, to make this macro run open the frm_menu_select and attach it to the action ONOPEN

In the dbase TOOLS/STARTUP make frm_menu_select the start up form
 

Users who are viewing this thread

Back
Top Bottom