Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Posts
    16

    Unanswered: Unable to obtain data from textboxes?

    I'm trying to apply my VB6 knowledge to Access to make my database a little more advanced. I have 20 rows of text boxes (4 boxes each row) with a calculation that needs to be done using subtraction...so I start coding with VB6 in access to try to get the data entered into those boxes to be calculated and then output into a textbox...but it's not working. it gives me some error about the textbox needing to have focus. this database is being created for basic level PC users so I cant have them clicking in the box everytime they need something calculated...is there an automated way of getting this done?

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    probably you are attacking the textboxes with something like:
    myVar = myTextBox.Text

    reading/writing the .Text property is only possible when the textbox has the focus.

    use instead:
    myVar = myTextBox
    which is exactly equivalent to:
    myVar = myTextBox.Value
    'cos .Value is the default property of a text box.

    ...no need to set focus to read/write .Value

    izy
    currently using SS 2008R2

  3. #3
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    thisBox.setfocus
    thisVar = thisBox.Text
    thatBox.setfocus
    thatVar = thatBox.Text

    also works, but why waste your life setting focus all over the place when .Value does the trick?

    izy
    currently using SS 2008R2

Posting Permissions

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