Reading public variables

Bakta

Registered User.
Local time
Today, 12:38
Joined
Aug 23, 2004
Messages
26
This is my first try with public variables and there are some problems, I'd like your help with.

Idea : I'd like to set a public boolean variable which can be read in various forms. My idea is to tie the visible aspect of various buttons to this value.

After reading the forum here, I came to understand this public value must be written in a separate module.

Here is what has been done so far :

Module named "GenVar"

Option compare database
Option Explicit
Public Bvisbtn as Boolean


Module named "MSetvis"

Public sub Setvis (Bvalue as Boolean)
Bvisbtn = Bvalue
End Sub

In one form I use a button which, on click, call the above sub like this : Msetvis (true), and another one Msetvis (false)

To test if the public value is properly modified, I made a dummy button on the same form and added on opening the form the following line :

Me.Btn_test.visible = Bvisbtn

This does not work. What I would like help with is how to test if this value is indeed properly set as required.
 
What you have the liiks fine. To test you could just add msg boxes, either to a button or where the event is meant to use the value.
MsgBox "Bvisbtn = " & Bvisbtn

peter
 

Users who are viewing this thread

Back
Top Bottom