Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2005
    Posts
    2

    Unanswered: .Text and .Value property of Text Box

    Hi,
    I have a question. What's the difference between the .Text and .Value property of a text box.

    I have a text box on a form and am displaying a Memo field from a table using the following statement

    txt6Rs.SetFocus
    txt6Rs.Text= !CR_Notes

    The data in the field is 2k characters long.

    It gives me an error "The setting for this property is too long". When I use .Value, I do not get that error. What is the difference between the two ?

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    For a difference between both properties, see:
    Text Property [Access 2003 VBA Language Reference]
    Value Property [Access 2003 VBA Language Reference]

    Is there a special reason why you need to use the Text property to assign a value to the control?
    Have a nice day!

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Sinndho's given you the links to the definitions.

    From a practical standpoint, in Access VBA, Text is seldom used, the rare exception being in code in the OnChange event of a Textbox, to determine how many characters have been entered, when this is needed, such as when alerting the user to how many characters are left for use. As you already know, it require that Focus currently be on the Textbox.

    The Value Property is used for basically everything else, from reading the data currently in the Control's underlying Field to assigning data to the same.

    Since the Value Property is the Default Property for Textboxes, in code it can be omitted. So

    Me.TextboxName.Value

    can simply be written as

    Me.TextboxName

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •