Unless you plan to reuse your "id" Integer from multiple Forms, method #2 is probably the best way to go about it.
codeorder
Posting Virtuoso
1,915 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384
A Global Declaration should be used for what it is.
There is no reason to add your "id" with the rest of the Global Declarations if only used once.
I would also add my "id" in the "public sub pull_data" if that Sub Procedure ends up having to use the "id" to process code.
If your "public sub pull_data" is needed for other results, not just for when the "id" is needed, Declaring something like "Static id as integer = newid" within that Sub Procedure should keep account for the "id"'s value.
Public Sub pull_data(Optional ByVal newid As Integer = 0)
Static id As Integer = newid
' MsgBox(id)
'select whatever from whatever where id = id
End Sub
codeorder
Posting Virtuoso
1,915 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384
Under those circumstances, declaring your "id" at a Class Level, seems appropriate.
I just thought I would offer a suggestion about using a Static Declaration within a Sub Procedure.
codeorder
Posting Virtuoso
1,915 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384