Results 1 to 4 of 4
  1. #1
    behnam is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    72

    How to set textbox value to same as one in combo box

    Hi uys,



    I want to set the textbox value of Text282 to the value selected in a combo box (Combo912).

    I tried

    Code:
    Text282=Combo912
    but its giving me numberical numbers not the string itself. I also tried
    Code:
    Text282=Combo912.value
    but get the same outcome.

    thanks for your time

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    The value of combobox is whichever column is set in the BoundColumn property.

    Does the combobox RowSource include an ID field? Is this the BoundColumn? You are saving the ID into record? Should not be saving the alias text. Display the alias in textbox ControlSource with an expression: = [Combo912].[Column](x)

    x would be the column index, which begins with 0. If the alias is in column 2 the index is 1.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    Text282=Combo912 is correct, so you may have the combo's bound column set to the number, not the name column.


    FYI, you can rename these so they make sense, like cboName, or txtLastName. (but it must be done before all the programming is done)

  4. #4
    behnam is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    72
    Thanks both of you!!!

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

Similar Threads

  1. combo box display field name on textbox
    By ultra5219 in forum Access
    Replies: 4
    Last Post: 05-21-2013, 02:43 PM
  2. Replies: 4
    Last Post: 11-16-2012, 09:06 PM
  3. How to clean textbox after update combo box
    By glen in forum Programming
    Replies: 1
    Last Post: 10-13-2012, 10:09 AM
  4. Replies: 2
    Last Post: 04-27-2012, 06:28 PM
  5. Replies: 7
    Last Post: 01-26-2012, 11:57 AM

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