Results 1 to 14 of 14
  1. #1
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419

    select from List BOX of the list of choices and store this into a table

    I created a form and created on it a list box which is a query that grabs certain number of fields from different tables.
    I would like the user to select from this list box of a choice and then store their selection into a table.

    This list box has three fields, but it needs to store the id rather than the item, the user would see the name of the item but the id of the item would be store into
    another table, called bid. It store all these three fields when a user selection one of the item from the list.

    How can I do this, please let me know. Your suggestion and advice is greatly appreciate it.

    Thanks!!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The bound column property determines which column is saved. The column widths property determines what columns are displayed.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    yes but the list has a bunch of records, how can I make the user select one of the record, and maybe in the future if it needs it, select a few and then the user's selection are store in a given table?

    The list doesn't have selection option, it only displays them.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    A listbox can be bound to a field in the form's source, though it gets more complicated if it's set to multiselect.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    a list box has a list of data in rows and columns, so how can it be bound to a table the of all the datas (column & rows) into a table the way a combox and textbox does?

    I also sort of knew that it would be complicated to select a list of data from a list in a list box and then have these data, along with their columns and row being able to populate into a given table.
    I guess in time I will figure it out and see how difficult it will be.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    The usual purpose of a listbox is same as a combobox or textbox, to save a value to a field of table, not to save an entire record. If you want to somehow use it to create a record from multiple selected items, that will require VBA code that cycles through the items of the listbox and does something with each that is selected. This might give you an idea of what that looks like: http://allenbrowne.com/ser-50.html

    Instead of building a filter string as shown in that example, you would have a recordset open and add record to the recordset and populate fields of the new record.
    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.

  7. #7
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    Ok thank you June7. Thanks for the link info.

    pbaldy

    I just noticed a problem with your auto fill, for example, when a user selects an item such as computer, it shows the time stamp of when is auction when is bid, and the seller, but the item is a name, and the seller is also a name.
    the seller and item is then bound to the bid table but it only accept id number and not the name, the seller on the form is in the name form, this presents a problem.

    How could I fix this? Thanks.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I'm not sure I understand, but you have to have the appropriate fields in the row source of the combo.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    Hi pbaldy,

    I know, is not easy to see it by mean explaining it in writing without seeing it yourself.

    What I meant is that, on the form, the user can see all the drop down of the combo box with names such as name of the person or name of an item rather than an id # that is use
    as a primary key. So lets say when a user use the combo box as an auto fill, once he selects an item, the user name in WORD's is auto populated in the text box, however I still want this user name to be populated on the
    table but as a user id in NUMBER rather than name in CHARACTER.

    I used your method and I couldn't do that because on the form is word and on the table is id#, the type doesn't match. So to make it work I end up having to make changes to the form that when a user selects an item,
    the auto filled for the user name is now ID (number) rather than name (character), so the type match so it can be copy back to the table. Thanks!!!

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    You need a multi-column combobox.
    The value of the combobox will be the ID and that value will be saved but the user will see name.
    Review: http://www.datapigtechnologies.com/f...combobox3.html
    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.

  11. #11
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    Quote Originally Posted by June7 View Post
    You need a multi-column combobox.
    The value of the combobox will be the ID and that value will be saved but the user will see name.
    Review: http://www.datapigtechnologies.com/f...combobox3.html
    June7,

    this is not just a multi-columnBox, this is a multi - column combo box that when a user selects an item the associated text box field is automatically filled.

    If it automatically fill it with a name value, character type, then it can't bound it to a table that has a integer type.

    If is not auto fill and all the fields are independent then what you say will works with the multi-Column Combo box, because you can create a query with multi-column, and select to see the name while bound the integer to a table with an integer type.

  12. #12
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Should not save the text value, only the key value.

    I don't understand your issue. The combobox can be bound to integer type field to save the key but the combobox will display the text.
    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.

  13. #13
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    Click image for larger version. 

Name:	bid.png 
Views:	10 
Size:	10.9 KB 
ID:	13696

    Hi June7,

    Here is what I meant, attached I have an image file of the scenario.
    See the iid Combo field, that is a combo box, when a user selects an item from there, it will auto populate
    the text field start time textBox, Seller textBox and Bid Time.

    Right now I have seller textBox auto filled instead of the seller name it is auto filling the sellers id number, the reason because this data is then bound to the bid table
    seller field that is of type integer.

    The problem is if I have the seller textbox auto filled as the seller name, character type, it can't bound to the bid type that is set as type integer.

    How can I have it auto filled character and bound an integer? Thanks!!

  14. #14
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    How are you doing the 'autofill'? If the seller is associated with the iid, why do you need to save the seller text into this record? Just save the iid. One way to display the related value is to include it as a column in the combobox. Then expression in textbox control source references the combobox column. Column index begins with 0: =[comboboxname].Column(x)
    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.

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

Similar Threads

  1. Replies: 2
    Last Post: 03-27-2012, 01:02 PM
  2. Help with form - list of choices
    By lios1984 in forum Access
    Replies: 11
    Last Post: 02-05-2012, 12:32 PM
  3. List of Choices
    By lios1984 in forum Access
    Replies: 4
    Last Post: 01-30-2012, 02:14 PM
  4. Replies: 9
    Last Post: 12-07-2011, 04:30 PM
  5. Replies: 1
    Last Post: 10-22-2010, 10:11 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