If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
How many times has a form been opened?
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? |
#2
|
|||
|
|||
How many times has a form been opened?
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 "iamnu" wrote: 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? . |
#3
|
|||
|
|||
How many times has a form been opened?
On Oct 22, 11:03*am, Mr. B
wrote: 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. Bhttp://www.askdoctoraccess.com/ Doctor Access Downloads Page:http://www.askdoctoraccess.com/DownloadPage.htm "iamnu" wrote: 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? . Okay, thanks... |
Thread Tools | |
Display Modes | |
|
|