By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,652 Members | 1,995 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,652 IT Pros & Developers. It's quick & easy.

assign textbox a global variable value

P: n/a
I have a textbox on a form that I want to use to display a public
variable.

How would I go about doing this? Could I use a label as well?

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Bruce Lawrence wrote:
I have a textbox on a form that I want to use to display a public
variable.

How would I go about doing this? Could I use a label as well?


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Use a public Function to read the variable:

Public myVariable As string

Public Function GetMyVariable() As String
GetMyVariable = myVariable
End Function

Set the TextBox's ControlSource to

=GetMyVariable()

To set a label's Caption you'd have to do something like this in the
Form's Open or Current event procedure:

Private Sub Form_Current()
Me!LabelName.Caption = myVariable
End Sub

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQnqQzIechKqOuFEgEQKVAwCghvF7RClQLc4nTiu8chU8AO hvw/0AoO43
x39OJE5RfqY3d4ufWAepFPLy
=vX/B
-----END PGP SIGNATURE-----
Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.