selective data acces depending on login

osullipa

Registered User.
Local time
Today, 18:16
Joined
Dec 7, 2004
Messages
31
I have a two level security system to protect my date. The first uses the MS Access security, the second is a simple login system wherby a user enters their name and personal password to gain a customised view of the data eg if the user is me, I can see all tool bars, other users cannot. What I would like to be able to do is write a query wherby I can use the users login details to diplay only their data. An example of the script I built is as follows

'IF USERNAME AND PASSWORDS CORRECT THEN LOGIN TO THE MAIN SWITCHBOARD

If Me.qpwd.Value = DLookup("PWD", "AUTHORISED", "USERID = '" & Me.quserid.Value & " '") Or UCase$(Me.qpwd.Value) = "abcd" Then
DoCmd.Close
DoCmd.OpenForm "Course Booking System"
Else
MsgBox "Invalid Password"
End If

Is there a way of including a select criteria like the following

SELECT USERID, DETAIL
FROM COURSE
WHERE USERID="Me.qpwd.Value"

I have tried several differnet versions for this syntax without success!

Any help would be greatly appreciated.

Regards

Peter
 
If it's just in a query, try:

WHERE USERID= Forms!FormName.quserid
 
pbaldy said:
If it's just in a query, try:

WHERE USERID= Forms!FormName.quserid
Thanks Paul. Unfortunately it didn't work! The query requests the name to be put in rather than seeing the actual login name! Any other suggestion?

Peter
 
I'm not sure what you mean by the query requested the name. Was the form open at the time? As long as it is, the query should get value from that control.
 

Users who are viewing this thread

Back
Top Bottom