Results 1 to 2 of 2
  1. #1
    B-dub is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2010
    Posts
    3

    Text Box to Variable


    I'm struggling with the code to assign the contents of a text box to a variable. I've tried VendorNameVar = Me.txbxVendorName.Value and VendorNameVar = Me.txbxVendorName.Text. I've tried triggering the code from various events (On Change, On Exit, On Lost Focus, etc). I've tried declaring my variable both at the module level and procedure level but my variable never obtains a value. I'm sure it's a fundamental error by a rookie. Any Thoughts?

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    my first thought would be that you're missing something very simple, or not disclosing it in your post, whether you know it or not.

    var=me.box should work just fine if you're writing the code in the form's actual module. are you sure you're typing it there? You can test this for sure by seeing if the NAME of the box appears in the dropdown list that appears after you type "me."

    if you're in the right place, it will be in the list. If you have no list and you're typing in the form module, you have the intellisense option turned off.

    the other thing to note is....HOW do you know that the var is not getting it?? If you're assuming, it's not a valid statement. Did you know you can follow variable values in the vbe through code, line by line?? there's a watch window you can view that will show you every variable, follow each ones value and detect when the value changes.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 11-05-2010, 04:31 PM
  2. Replies: 15
    Last Post: 09-18-2010, 01:19 PM
  3. Replies: 4
    Last Post: 08-05-2010, 01:26 PM
  4. Replies: 3
    Last Post: 07-05-2010, 10:46 PM
  5. Refering to variable form names inside a variable
    By redpetfran in forum Programming
    Replies: 2
    Last Post: 05-21-2010, 01:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums