How many times has a form been opened?

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?
 
M

Mr. B

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
 
I

iamnu

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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top