validate variable with table data

anishkgt

Registered User.
Local time
Today, 19:58
Joined
Nov 4, 2013
Messages
384
Hi,

I am trying to deny users from logging on from multiple pc's. Here is how i've got it so far,

  1. created table tblLoginLock with fields EmpID and LoggedIn both numberical data type
  2. created a form to set the Empid with tempvar!TempEmpId and LoggedIn as 1 when a user logs in
  3. When he clicks the logOff button he is signed out and a form opens up and closes to set the LoggedIn field to 0
Now whenever a user is signed the LoggedIn Field is checked with this expression
Code:
DLookUp("[TempVars]!TempEmpID","tblLoginLock","[LoggedIn]=1")
if there is a one then the user is logged in the condtion is met and a message box pops up to warn the user that he is already logged in.


The problem:
The above code does not check the specific TempVar to the LoggedIn field, the LoggedIn field is randomly checked for a '1' meaning if there is a '1' anywhere in the table then the condition is met and the user denied. how can i set the condition to validate the logged in user to the LoggedIn field.
 
Something like

DLookUp("FieldName","tblLoginLock","[LoggedIn]=1 And EmpID =" & [TempVars]!TempEmpID)
 
Cool ! Thanks paul worked like a charm. :)
 

Users who are viewing this thread

Back
Top Bottom