Right under the line Option Compare Database, enter the following line:
Then, in the definition of Command0_Click, enter the following:
Next, we can test the code. Use the task bar to switch back to Microsoft Access, and switch the view to “Form View”.
You can now try to click the button a few times. Each time you click the button, the number displayed on the button should increment.
Congratulations, you have just used variables in VBA!