Hi JH
I have written a Purchase Order database and needed to prevent users from seeing other users Purchase Orders but at the same time allow senior Managers to approve purchase orders.
I am assuming as you have multiple users that they will be members of a network and therefore have a User Name.
The code below (tested on Win 2k and XP) will extract the logged on users name from the registry.
*****************************************
Dim strRegValue As String
Dim WshShell As Object
Set WshShell = CreateObject("Wscript.Shell"
strRegValue = WshShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Logon User Name"
UserName = strRegValue
*****************************************
You will need to record the UserName when the record is created and this can be done using the same code and recording it in the table along with the users record.
When the users want to view their records I use a form which uses the code to put the UserName in a hidden text box and then I use a sub form and query to filter the records to only show the records that user created.
To allow a supervisor to view all records I would create a different form with a query and subform that will show all records if the logged on user is a supervisor.
Security is very high using this method as you are using the network logon to verify the users identity. This assumes of course that you have prevented users from accessing the database window and design view.
For added security I also add a timestamp field to record the user and time of any changes
********************************
TimeChanged = Now
********************************
Hope this helps