|
 |
access thread: Now()
Message #1 by "Steve Klein" <Stephen@K...> on Tue, 11 Mar 2003 20:57:18 -0000
|
|
Signed StationeryI have a module designed to log a user out if they do not
put the focus on certain controls within a given period.
The problem is that it does so by logging last usage in a table in date
format - UK style
It then calculates the difference between the current time and the entry on
the last usage table.
The problem is that in VB Now() is always thought of in American and so the
sums always go wrong. Does anyone know how to control for this.
Or better still, does anybody have an effective mechanism for timing out
people who have not used the application for a given period
Steve K
~~~~~~~~~~~~~~~~~~
Steve Klein
tel: 0118 984 5109
mobile 0797 181 5676
~~~~~~~~~~~~~~~~~
Message #2 by "Brian Skelton" <brian.skelton@b...> on Tue, 11 Mar 2003 22:04:58 -0000
|
|
Steve
Are you using a date/time field to hold the last use date? Are you using
a datetime variable to hold the contents of this field when you retrieve
it from the table? Are you using the DateDiff function to work out the
difference between the date and Now()? If you are, then it shouldn't
matter what format the Now() function returns as a date as, the
calculation will be correct.
Access holds all dates as numbers - the integer part represents the date
and the decimal the time - everything else is just presentation,
dependent on your national settings and any special formatting you've
applied.
One possible improvement on the process would be to hold the 'last use'
date/time in a static variable in the function that checks whether to
log the user off - it saves all that reading from and writing to the
database.
Brian
-----Original Message-----
From: Steve Klein [mailto:Stephen@K...]
Sent: 11 March 2003 20:57
To: Access
Subject: [access] Now()
Signed StationeryI have a module designed to log a user out if they do
not
put the focus on certain controls within a given period.
The problem is that it does so by logging last usage in a table in date
format - UK style
It then calculates the difference between the current time and the entry
on
the last usage table.
The problem is that in VB Now() is always thought of in American and so
the
sums always go wrong. Does anyone know how to control for this.
Or better still, does anybody have an effective mechanism for timing out
people who have not used the application for a given period
Steve K
~~~~~~~~~~~~~~~~~~
Steve Klein
tel: 0118 984 5109
mobile 0797 181 5676
~~~~~~~~~~~~~~~~~
Message #3 by "Steve Klein" <Stephen@K...> on Wed, 12 Mar 2003 05:55:56 -0000
|
|
Switched time last used to a static variable.
Far less code and mess
and it worked
Thanks
Steve K
-----Original Message-----
From: Brian Skelton [mailto:brian.skelton@b...]
Sent: 11 March 2003 22:05
To: Access
Subject: [access] RE: Now()
Steve
Are you using a date/time field to hold the last use date? Are you using
a datetime variable to hold the contents of this field when you retrieve
it from the table? Are you using the DateDiff function to work out the
difference between the date and Now()? If you are, then it shouldn't
matter what format the Now() function returns as a date as, the
calculation will be correct.
Access holds all dates as numbers - the integer part represents the date
and the decimal the time - everything else is just presentation,
dependent on your national settings and any special formatting you've
applied.
One possible improvement on the process would be to hold the 'last use'
date/time in a static variable in the function that checks whether to
log the user off - it saves all that reading from and writing to the
database.
Brian
-----Original Message-----
From: Steve Klein [mailto:Stephen@K...]
Sent: 11 March 2003 20:57
To: Access
Subject: [access] Now()
Signed StationeryI have a module designed to log a user out if they do
not
put the focus on certain controls within a given period.
The problem is that it does so by logging last usage in a table in date
format - UK style
It then calculates the difference between the current time and the entry
on
the last usage table.
The problem is that in VB Now() is always thought of in American and so
the
sums always go wrong. Does anyone know how to control for this.
Or better still, does anybody have an effective mechanism for timing out
people who have not used the application for a given period
Steve K
~~~~~~~~~~~~~~~~~~
Steve Klein
tel: 0118 984 5109
mobile 0797 181 5676
~~~~~~~~~~~~~~~~~
|
|
 |