E
Edo2008
I've read in several Access 2007 books that I can have a CLASS MODULE
(not one bound to a form or report) define public variables,
subroutines and functions. So I defined a public varable, a public
SetID subroutine and a public GetID function. This is all in Class1.
From a form, if I call SetID (2), I get "Sub or Function not defined".
From a form, if I call Class1.SetID (2), I get "Runtime Error 424.
Object Required".
Can someone tell me how to store just one global variable I can set
from one form and access from another (even if the first form is
closed)?
Thanks
-Ed
This is Class1
Option Compare Database
Option Explicit
Public gIntPatientID As Integer 'Currently Selected Patient
Public Sub SetID (intID As Integer)
gIntPatientID = intID
End Sub
Public Function GetPatientID()
GetPatientID = gIntPatientID
End Function
(not one bound to a form or report) define public variables,
subroutines and functions. So I defined a public varable, a public
SetID subroutine and a public GetID function. This is all in Class1.
From a form, if I call SetID (2), I get "Sub or Function not defined".
From a form, if I call Class1.SetID (2), I get "Runtime Error 424.
Object Required".
Can someone tell me how to store just one global variable I can set
from one form and access from another (even if the first form is
closed)?
Thanks
-Ed
This is Class1
Option Compare Database
Option Explicit
Public gIntPatientID As Integer 'Currently Selected Patient
Public Sub SetID (intID As Integer)
gIntPatientID = intID
End Sub
Public Function GetPatientID()
GetPatientID = gIntPatientID
End Function