Results 1 to 4 of 4
  1. #1
    ballaterach is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Feb 2014
    Posts
    9

    Talking Automatically Fill in value in one field based on selection from combo box

    I have a form with a combo box with 8 values in. I want to have a text box in the same form which will automatically be populated
    with a value (price) based on the value selected from the combo box.

    Simple answer would be good as I'm getting old

    Thanks in advance!!

  2. #2
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    In afterupdate event of the combo box,

    me![TEXTBOX] = me![COMBOBOX].column(#) ' WHERE # is the column value that you want in the combobox minus 1 because of the combobox column counting start from 0

  3. #3
    ballaterach is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Feb 2014
    Posts
    9
    Hi thanks for your response; not trying to be smart but 'is the column value that you want in the combobox minus1...' should read 'is the column value that you want in the text box minus1...'
    and do I need to replace 'me' with the name of my form? thank you sorry to sound stupid haven't used access for ages and its all gone from my head!!


    Quote Originally Posted by lfpm062010 View Post
    In afterupdate event of the combo box,

    me![TEXTBOX] = me![COMBOBOX].column(#) ' WHERE # is the column value that you want in the combobox minus 1 because of the combobox column counting start from 0

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by ballaterach View Post

    'is the column value that you want in the combobox minus1...' should read 'is the column value that you want in the text box minus1...'
    Yes; that was a typo.

    Quote Originally Posted by ballaterach View Post

    do I need to replace 'me' with the name of my form
    No; Me. is an alias for the current Form. If you have code in a Form's code module that says

    Me.MyTextboxName


    it is referring to a Control, on that Form, named MyTextboxName.

    It's just a shortcut, if you will, that keeps you from continually typing a complete reference to the Form.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Replies: 2
    Last Post: 01-26-2013, 07:53 PM
  2. Automatically fill in field in a loop
    By RachelBedi in forum Forms
    Replies: 3
    Last Post: 10-24-2012, 12:40 PM
  3. Replies: 10
    Last Post: 11-21-2011, 02:56 AM
  4. Replies: 0
    Last Post: 06-29-2011, 01:04 PM
  5. Replies: 2
    Last Post: 09-20-2010, 09:02 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