A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How many times has a form been opened?



 
 
Thread Tools Display Modes
  #1  
Old October 22nd, 2009, 05:08 PM posted to microsoft.public.access.forms
iamnu
external usenet poster
 
Posts: 99
Default 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  
Old October 22nd, 2009, 06:03 PM posted to microsoft.public.access.forms
Mr. B[_4_]
external usenet poster
 
Posts: 171
Default 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  
Old October 22nd, 2009, 06:40 PM posted to microsoft.public.access.forms
iamnu
external usenet poster
 
Posts: 99
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:55 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.