Procedure-Level Variables

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am successful in the 1st Procedure-Level variable but then I try the next
procedure level after saving the 1st and also in another module, but am still
unsuccessful.

The Msg box just appears blank.
 
I am successful in the 1st Procedure-Level variable but then I try the next
procedure level after saving the 1st and also in another module, but am still
unsuccessful.

The Msg box just appears blank.

Please post the relevant portion of your code. I have NO trace of an
idea what you're trying to do.


John W. Vinson[MVP]
 
Craig said:
I am successful in the 1st Procedure-Level variable but then I try the next
procedure level after saving the 1st and also in another module, but am still
unsuccessful.

The Msg box just appears blank.

Craig,

Could you provide a more extensive description, please?


Sincerely,

Chris O.
 
I would like to provide the code I used:

Option Compare Database

Sub Suburb()
Dim Suburb As String
Suburb = Charlestown
MsgBox Suburb
End Sub

I also tried using it as a private sub and public sub.

Yours Sincerely,
 
Craig said:
I would like to provide the code I used:

Option Compare Database

Sub Suburb()
Dim Suburb As String
Suburb = Charlestown
MsgBox Suburb
End Sub

I also tried using it as a private sub and public sub.

Yours Sincerely,

"Chris2" wrote:

Craig,

When I execute the code, the debugger stops, highlighting
"Charlestown". The error was: "Compile Error: Variable Not Defined."

The variable Charlestown must be declared, usually via Dim, before
being used.

If Charlestown is a string, it must be enclosed in "".

Sub Suburb()
Dim Suburb As String
Suburb = "Charlestown"
MsgBox Suburb
End Sub

The above code will execute, and a MsgBox appears with the word
"Charlestown" in it.


Sincerely,

Chris O.
 
Back
Top