Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setting constants by referencing a text box on a form

Status
Not open for further replies.

scottian

Programmer
Jul 3, 2003
955
GB
can a constant be set using a control on a form?

ive got a form with a text box on it. The user inputs some text and then clicks a button whereupon the code runs. But i get an error - "constant expression required". Any help or info is greatly appreciated.

Const conMAX_ROWS = 20000
Const conSHT_NAME = frmTxtBox
Const conWKB_NAME = "C:\MDP\Book1.xls"


"Children are smarter than any of us. Know how I know that? I don't know one child with a full time job and children."...Bill Hicks
 
I have not seen any way to do this, and I can't think of a single reason to do it. Why would you want a constant equal to some variable when you can just set some variable to that value.

Paul
 
Code:
Const conSHT_NAME = frmTxtBox
Here is your error. The whole point of coding a constant is to NOT make it variable. If you need to share out the value, you can dim it as public.

Money can't buy happiness -- but somehow it's more comfortable to cry in a Corvette than in a Yugo.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top