BvCF
MIS
- Nov 11, 2006
- 92
Problem: Employer ID number is displayed in AssignedTo field within form and also in main Access table.
What is the quickest method to modify the database so that the Access database forms display Username in the AssignedTo
field instead of the Employee ID number? Also, anytime I create a query and build a listbox on the query, the employee
id is displayed instead of the username.
Currently, I am using a global variable throughout the Access database, a Employee table
and several key queries and/or mudules to restrict access to the data within the Access
database. In other words, the end-user should only be able to view the accounts assigned to them.
Employee table
Employee_ID------Username-----Password----AccessLevel
1----------------Ann----------****--------E
2----------------Jill---------******------M
3----------------Joe----------******------E
4----------------Jack---------*****-------E
5----------------Sue----------***---------M
6----------------Biol---------****--------E
Access_List
SELECT L_Employees.Employee_ID
FROM L_Employees
WHERE (((L_Employees.Employee_ID)=get_global('employee_id'))) OR (((get_global('access_level'))="M"));
Module
Option Compare Database
Global GBL_Access_Level As String
Global GBL_Employee_ID As Long ' initially formatted as String
Option Explicit
Public Function get_global(G_name As String)
Select Case G_name
Case "access_level"
get_global = GBL_Access_Level
Case "Employee_ID"
get_global = GBL_Employee_ID
End Select
End Function
Sub set_globals()
GBL_Access_Level = "X"
End Sub
qryPopulateListBox (Used to enable the end user to only see his/her accounts in the listbox)
SELECT tblVar.AcctOrig, tblVar.AcctCurrent, tblVar.AcctNo, tblVar.Balance,tblVar.ExpPymt
FROM tblVar
WHERE (((tblVar.AssignedTo) In (select employee_id from Access_List)));
What is the quickest method to modify the database so that the Access database forms display Username in the AssignedTo
field instead of the Employee ID number? Also, anytime I create a query and build a listbox on the query, the employee
id is displayed instead of the username.
Currently, I am using a global variable throughout the Access database, a Employee table
and several key queries and/or mudules to restrict access to the data within the Access
database. In other words, the end-user should only be able to view the accounts assigned to them.
Employee table
Employee_ID------Username-----Password----AccessLevel
1----------------Ann----------****--------E
2----------------Jill---------******------M
3----------------Joe----------******------E
4----------------Jack---------*****-------E
5----------------Sue----------***---------M
6----------------Biol---------****--------E
Access_List
SELECT L_Employees.Employee_ID
FROM L_Employees
WHERE (((L_Employees.Employee_ID)=get_global('employee_id'))) OR (((get_global('access_level'))="M"));
Module
Option Compare Database
Global GBL_Access_Level As String
Global GBL_Employee_ID As Long ' initially formatted as String
Option Explicit
Public Function get_global(G_name As String)
Select Case G_name
Case "access_level"
get_global = GBL_Access_Level
Case "Employee_ID"
get_global = GBL_Employee_ID
End Select
End Function
Sub set_globals()
GBL_Access_Level = "X"
End Sub
qryPopulateListBox (Used to enable the end user to only see his/her accounts in the listbox)
SELECT tblVar.AcctOrig, tblVar.AcctCurrent, tblVar.AcctNo, tblVar.Balance,tblVar.ExpPymt
FROM tblVar
WHERE (((tblVar.AssignedTo) In (select employee_id from Access_List)));