Ben McCall
Registered User.
- Local time
- Today, 23:13
- Joined
- Jun 20, 2001
- Messages
- 22
I have a database in access 97.
I have a main form with two subforms.
I want to use a global variable "pre" in the main form and one subform.
My understanding was that I could declare it in the main declarations of the main form as follows:
Option Compare Database
Option Explicit
Public pre As Integer
I would like to give it a value of 1 in the mainform(after declaring "dim pre as integer") Then I have declared "dim pre as integer" in the sub form and entered:
If pre = 1 then
pre = 0
else
DoCmd.GoToRecord , , acNewRec
end if
If I put a breakpoint on "If pre = 1 then" and check the value of "pre", it is "0".
It is obvious that "pre" is not a global variable or I am completely confused.
Can anyone help?
Thanks!
Ben McCall
I have a main form with two subforms.
I want to use a global variable "pre" in the main form and one subform.
My understanding was that I could declare it in the main declarations of the main form as follows:
Option Compare Database
Option Explicit
Public pre As Integer
I would like to give it a value of 1 in the mainform(after declaring "dim pre as integer") Then I have declared "dim pre as integer" in the sub form and entered:
If pre = 1 then
pre = 0
else
DoCmd.GoToRecord , , acNewRec
end if
If I put a breakpoint on "If pre = 1 then" and check the value of "pre", it is "0".
It is obvious that "pre" is not a global variable or I am completely confused.
Can anyone help?
Thanks!
Ben McCall