Hi All,
I currently need to store 3 variables to be used as global variables throughout my application. I need to record the username, their employee group and the task they are doing. The username, for example, is entered into a field on a table to indicate who last worked on that particular record. I have created the code below and it seems to work fine except when the application occasionally errors out at which point the global variables lose their values. Is there a way to prevent the global variables from being reset until the database is closed? I've researched online but haven't found what I'm looking for yet. Also, just curious, but in a multi-user environment these global variables must obviously be local to a particular machine so that if two people log in at the same time they both have their own name stored in their own global variable. Is this true? If so, are these stored within the memory of each local machine?
The code below is in my Globals module
On my Login Form I ask the user to pick their name, employee group and task they will be performing from a set of 3 combo boxes. I record these values with the click event of a button on the form as follows :
I currently need to store 3 variables to be used as global variables throughout my application. I need to record the username, their employee group and the task they are doing. The username, for example, is entered into a field on a table to indicate who last worked on that particular record. I have created the code below and it seems to work fine except when the application occasionally errors out at which point the global variables lose their values. Is there a way to prevent the global variables from being reset until the database is closed? I've researched online but haven't found what I'm looking for yet. Also, just curious, but in a multi-user environment these global variables must obviously be local to a particular machine so that if two people log in at the same time they both have their own name stored in their own global variable. Is this true? If so, are these stored within the memory of each local machine?
The code below is in my Globals module
Code:
Option Compare Database Global g_username As String Global g_group As String Global g_task As String Public Function Init_Globals() g_username = "" g_group = "" g_task = "" End Function Public Function get_global(gbl_parm) Select Case gbl_parm Case "g_group" get_global = g_group Case "g_username" get_global = g_username Case "g_task" get_global = g_task End Select End Function
Code:
g_username = Me.USERNAME g_group = Me.Group g_task = Me.Task_Combo_Box
Comment