How many times has a form been opened?

  • Thread starter Thread starter iamnu
  • Start date Start date
I

iamnu

Is it necessary to have a table just to keep track of the number of
times a form has been opened, or is there another way to accomplish
this with code?
 
If you are wanting to for some reason track the number of times the form has
been opened over the lifetime of the database, then you would need a table
and some VBA code.

If you are only wanting to keep a count of the number of times the form has
been opened since the database was opened, then you could use a Public
variable (define it at a module level) and then use VBA code in the "On Open"
event of the form to increment the value in the variable each time the form
is opened.

'declare your variable in a module
Public lngFrmOpenCnt as long

'use this coed in the On Open event of the form
lngFrmOpenCnt = lngFrmOpenCnt + 1

The "lngFrmOpenCnt " variable can be checked at any time to see what the
current value is, even just before the database is closed.

-----
HTH
Mr. B
http://www.askdoctoraccess.com/
Doctor Access Downloads Page:
http://www.askdoctoraccess.com/DownloadPage.htm
 
If you are wanting to for some reason track the number of times the form has
been opened over the lifetime of the database, then you would need a table
and some VBA code.

If you are only wanting to keep a count of the number of times the form has
been opened since the database was opened, then you could use a Public
variable (define it at a module level) and then use VBA code in the "On Open"
event of the form to increment the value in the variable each time the form
is opened.

'declare your variable in a module
Public lngFrmOpenCnt as long

'use this coed in the On Open event of the form
lngFrmOpenCnt  = lngFrmOpenCnt  + 1

The "lngFrmOpenCnt " variable can be checked at any time to see what the
current value is, even just before the database is closed.

Okay, thanks...
 
Back
Top