Global Variables

jobrien4

Registered User.
Local time
Today, 14:27
Joined
Sep 12, 2011
Messages
51
I have set up a database and thus far only set variables at each form, however, now I see the need to set these variables up at the database level. I am having issues though.

For example, I have a Search Form. When the user searches and finds right customer, they can double click it and open it up in a new form.

Previously, in the new form I would do this:

Dim CustomerNumber As Integer
CustomerNumber = Forms!SearchForm!CustomerNumber!

In order to use a global variable I have tried the following:

Public CustomerNum as Integer

Public Sub NewQuoteButton_Click()
CustomerNum = Me.SearchResults.Column(0)

DoCmd.OpenForm "frm_PartQuote", acNormal, , ("[CustomerNumber] =" & CustomerNum), acFormEdit


When the new form opens, a line of code that references CustomerNum gives me the following error:

"Compile Error: Variable Not Defined"

What am I doing wrong?
 

Users who are viewing this thread

Back
Top Bottom