Control Source

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

I have a text box wherein I want to bind to
a public variable. E.g.,
Public strVarName As String

How do I specify that in the text box property
sheet? I thought about writing a simple function
that returns the current value, but have the idea
it can be done more simply?

(What I'm actually doing is replacing a hard-coded
label on a form with a text box whose value comes
from the installation properties.)

Thanks,
Bill
 
Only way to return the value of a variable to a textbox would be to call a
function that returns as its value the value of that variable.

=MyFunction()

Public Function MyFunction()
MyFunction = VariableName
End Function
 
Bill said:
I have a text box wherein I want to bind to
a public variable. E.g.,
Public strVarName As String

How do I specify that in the text box property
sheet? I thought about writing a simple function
that returns the current value, but have the idea
it can be done more simply?

(What I'm actually doing is replacing a hard-coded
label on a form with a text box whose value comes
from the installation properties.)

Thanks,
Bill

I usually use public properties in a standard module. Then the text box
can call the Property Get procedure.
 
Thanks, it's done.
Bill


Ken Snell said:
Only way to return the value of a variable to a textbox would be to call a
function that returns as its value the value of that variable.

=MyFunction()

Public Function MyFunction()
MyFunction = VariableName
End Function
 
Dirk,

That's also precisely how I handle global variables. They
ALL reside in the same general module and whatever
functions might be necessary to both retrieve and set them
are also coded in that module.

As I said in my original post, I had the idea that it could
be done without a function. Anyway, I followed Ken's
suggestion and simply added another function in the
general module.

By-the-way, your post here reminds me I need to post
a follow-up to you on the "SendObjectAction" thread from
last week... I'll do that now.

Bill
 
Bill said:
Dirk,

That's also precisely how I handle global variables. They
ALL reside in the same general module and whatever
functions might be necessary to both retrieve and set them
are also coded in that module.

As I said in my original post, I had the idea that it could
be done without a function. Anyway, I followed Ken's
suggestion and simply added another function in the
general module.

Some people stick them in unbound controls on a hidden form. Then you
can use

=Forms!frmSettings!SomeControl
By-the-way, your post here reminds me I need to post
a follow-up to you on the "SendObjectAction" thread from
last week... I'll do that now.

I'll look, but it's getting late, so it may have to wait until tomorrow.
 
Back
Top