0

I was wondering if it is possible to use the Detect idle time method mentioned in the link below, but make it user specific. MS Link for Detect idle time code: http://support.microsoft.com/en-us/kb/128814

My database (Access 2010) currently records a Network usrname, would be possible to use something like

If usrname = X then IDLEMINUTES = 100 
Else IDLEMINUTES = 20
End If

to make the idle time different per usrname?

Thanks in advance!

cryocaustik
  • 439
  • 2
  • 8
  • 20

2 Answers2

1

Yes, you could do this, using the code you linked to:

Dim IdleMinutes as Integer
If Environ("UserName") = "jdoe" Then IdleMinutes = 100
    Else IdleMinutes = 20
End If

Note that I'm defining IdleMinutes as a variable, not as a constant, as they show in their sample code. That's because you can't redefine a constant (from Microsoft):

Once a constant is declared, it cannot be modified or assigned a new value.

Also, while Access has a method called CurrentUser(), you don't want to call that, because that tells you the Access username, which is usually "Admin", unless you're using Access Security, which isn't very common. If you don't want to use the environment variable, you can use a WinAPI call as shown here, although I use Environ("UserName") and it works fine.

Community
  • 1
  • 1
James Toomey
  • 5,635
  • 3
  • 37
  • 41
0

I have a table of users where I have the idle time field as an integer. I pick the users idle-time allowed. Hence not restricted to the Logical if or EVEN case.

Works like a charm.

Godza
  • 1