Results 1 to 8 of 8
  1. #1
    caveny123 is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    4

    Item selected in combo box is not the value returned

    I have a combo box in a form that looks up menu items. The combo box displays both price and name, but is bound to the price (used to calculate a total). The problem I am having is that about half of the menu selections are not working properly. When I select them, they do not appear in the textbox (or combobox). Instead a random other menu item is input into the textbox.



    For example, when I select "French Dip", the value returned is always "Fish Tacos". When I select "Hot Dogs", the value returned is always "Fountain Soda Small".

    I cannot find any pattern to the problem. The menu items that aren't working in the combobox are not at the end of the list, at the start, in a certain food category, etc....

    Any help would be greatly appreciated!!!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,953
    Show the properties for the combobox:
    RowSource
    BoundColumn
    ColumnCount
    ColumnWidths

    Is the textbox bound? How are you populating the textbox? ControlSource expression or code? Show that.
    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
    caveny123 is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    4
    Row Source: SELECT [Menu].[MenuName], [Menu].[MenuPrice] FROM Menu ORDER BY [MenuName];

    Bound Column: 2
    Column Count: 2
    Column Widths: Blank

    I'm not sure what you mean by "Is the textbox bound? How are you populating the textbox? ControlSource expression or code?"?

    I may have misworded my original question, but there is only a combobox. This combobox is not displaying what item is clicked in the list. Does this help?

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,953
    When I select them, they do not appear in the textbox (or combobox).
    This had me thinking you wanted a value from the combobox row to show in a textbox. My misreading.

    Need ColumnWidths set to something like: 2";.25"

    Is the combobox in a Continuous or Datasheet view form? Is the Combobox bound (I should have also asked for the ControlSource property) to a field of form RecordSource? If so, show the form's RecordSource.

    Think I will have to see the objects to analyse further. If you want to attach project (or an extract of the relevent objects) I will look at. Make copy, remove confidential data, run Compact & repair, zip if still large.
    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.

  5. #5
    caveny123 is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    4
    Could I have your email address to send it to you directly. Or if you do not want to share that online, could you send me an email at harpoleandwhite@gmail.com and I will reply with the full database. Thankyou very much for your time!!!

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,953
    I prefer that you provide the db through the forum tools.
    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
    caveny123 is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    4
    Here is the db

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,953
    Problem is combobox is bound to the price field, not the MenuID key (which is not in the RowSource query for MenuItemTest). This saves the price to table and treats this value as the lookup key. French Dip and Fish Tacos have the same price and alphabetically Fish is before French. So the lookup matches 7.50 to the first record with this value and returns that name. You need to save the MenuID value. If you want to save the price so that the price at time of sale is archived and not impacted by future changes in price, will need code to save that value to another field. Or for each price change create a new record in Menu. Have a field in Menu table called 'Active'. Deactivate out of date price records. Include only active records in the RowSource. Either way, if you want to document the name, need to save the key or the name. Again, saving name, like the price, will require code. Saving this data negates relational database principal of not duplicating data.
    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. Combo Box Determines Radio Button Selected
    By sainttomn in forum Forms
    Replies: 5
    Last Post: 08-10-2011, 03:51 PM
  2. Replies: 4
    Last Post: 07-27-2011, 09:52 AM
  3. Replies: 1
    Last Post: 11-23-2010, 01:30 PM
  4. Replies: 3
    Last Post: 10-07-2010, 09:36 AM
  5. Combo-box to select item to edit in Form
    By DHavokD in forum Forms
    Replies: 7
    Last Post: 06-05-2009, 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