Do you need to keep track of clicks even when the database closes, or just for the current session?
If just for the current session, you would create a global variable and initialize it to 0 when the database starts up. TempVars are an alternative to global variables if you are using Access 2007 or later with the .accdb format.
If you need to store the click count for use the next time the database opens, you would need to create a field in a table for it....
With global variables or a field in a table (assuming the field is part of your form's recordsource), the code would look something like this in the button click event:
- Something = Something + 1
Tempvars would use a different syntax... you'd initialize it in some startup code:
-
Tempvars.Add "ClickCounter", 0
and then increment it in your click event:
-
Tempvars("ClickCounter") = Tempvars("ClickCounter") + 1
Tempvars have an advantage over global variables in that they can be seen/used anywhere in the database... code, queries, property sheets, etc...
EDIT****
Apologies - I thought this was an MS Access question. this response might not apply. I imagine in VB, you could use a public variable for this. If VB.Net/asp.net, session variables.