Declaring Public Variables

B

Bill Johnson

I need to pass a variable multiple times to an unbound form.

I have a module names modSetPublicVariables with just one statement in it at
this point:

Option Compare Database
Option Explicit

Public v_GL As String

When the database is opened a splashscreen (unbound form) appears that sets
and resets some tables and such I set the value of this variable in that form
and using a MsgBox have validated that the value is set properly.

v_GL = rst5.Fields("GL")

MsgBox v_GL

Everything is great up to this point. The message box shows 4801. This
form closes then opens the MainMenu form

There is a button on this form that will either be visible or invisible
based on the v_GL variable

Select Case v_GL
Case "1312"
Me.cmdOpenOb.Visible = True
Me.lblOb.Visible = True
Case "4801"
Me.cmdOpenCo.Visible = True
Me.lblCo.Visible = True
Case Else
MsgBox "Your stupid variable is empty"
End Select

So... I would expect this to fall down to Case "4801" but I get the Case
Else. I've lost the value when the splashscreen closed and this form opened.

I must be doing something wrong somewhere because I had this working at one
point.
 
B

Bill Johnson

Thanks!

Leaving that open lets me reference that variable for everything

Appreciate the help.

Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top