Refering to Unbound Text Boxes on Form

mikewood1980

Registered User.
Local time
Today, 11:57
Joined
May 14, 2008
Messages
45
Hi

Could anyone please tell me how to refer to the data entered into a text box on an unbound form. For example if I want to manipulate the string written into a text box by the user, what variable to I use to the string (eg if my box is called TextBox).

Thanks for your help!
Mike
 
refering to a unbound form or control is no different than the bound equevalent??

Forms("FormName").COntolename
 
ok - so if I put the following code will I get the user entered data?

dim strTextBoxContents as string
strTextBoxContents = Forms("FormName").TextBoxName

Thanks!
Mike
 
if you enter a value in a box called "mybox1"

the default value of a textbox IS the contents, so you dont need any qualifier

so simply

msgbox(mybox1) will show you the contents

not mybox1.text, or mybox1.value - some of these expressions may be correct, but others arent and will prduce errors.

the only real exception to this is a label in which case you DO need to use he Caption property

so

msgbox(mylabel.caption)

[edited - i put quotes round the identifiers, which was wrong - you dont need them]
 
Last edited:
(eg if my box is called TextBox).

If referring to the control from the Forms module:

szTextBoxText = Me.TextBox
 

Users who are viewing this thread

Back
Top Bottom