Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    tweety is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Nov 2012
    Posts
    126

    Combo Box Values based on another combo box selection

    Hi



    i have a form, with a subform and another subform

    Click image for larger version. 

Name:	1.png 
Views:	11 
Size:	74.7 KB 
ID:	11075
    once a supplier name is selected from the combo box i only want it displayed that suppliers products in the subform, subform. (products combo box) I can get a basic query to show these results but can get the combo box to do the same.

    the design screen is also attached below
    Click image for larger version. 

Name:	2.png 
Views:	9 
Size:	105.3 KB 
ID:	11076

    thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Sounds like dependent (cascading) comboboxes. Review http://datapigtechnologies.com/flash...combobox2.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.

  3. #3
    tweety is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Nov 2012
    Posts
    126
    thanks i didnt know it was called cascading, iv linked both the boxes up but cant do the requery bit, how can i tell access that i looking at a form, subform and another subform then a control?

    thanks

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Don't understand the question. Why can't you requry the dependent combobox? What are you doing that is different from the tutorial?
    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
    tweety is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Nov 2012
    Posts
    126
    hm i started it again to make iam not doing anything wrong

    i put the following code in the second combo box
    Click image for larger version. 

Name:	1.png 
Views:	9 
Size:	23.1 KB 
ID:	11097

    as so i open the form now it asks me to enter enter parameter value??? for the first combo box?

    just to refresh i have the supplier combo box on the purchase form, and the product combo box with the code is on the subform and another subform

    any ideas anyone???
    Last edited by tweety; 02-10-2013 at 03:33 PM.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    So the two dependent comboboxes are not on the same form. This is different from the tutorial and definitely more complicated. Actually never seen this attempted. I don't really understand the forms. If you want to provide database for analysis, follow instructions at bottom of my post. However, I won't be able to review it until after Feb 22.
    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
    tweety is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Nov 2012
    Posts
    126
    ok, so the record purchase orders form from the main menu, thats the form with the problem. when a supplier name is selected its set to create a blank record with todays date. the user should only be able to select products from the supplier selected, so for example when your select vista, then from the products combo box you should only see jelly cones and jelly sticks, when sweet world is selected then only bubble gum, gomets 8, gomets 10, lol pop and gummies etc.

    i can run a simple query, to get this results....

    now the supplier get is values from the supplier.supplierName and the products from product.

    hoping iv explained myself, if you have any question please ask

    thanks
    Attached Files Attached Files

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Oh Boy! This is a form/subform/subsubform arrangement with dependent comboboxes on form and subsubform. Never seen this before.

    RowSource of the Product combobox needs a WHERE clause.
    SELECT Product.ProductID, Product.ProductName FROM Product WHERE (((Product.SupplierID)=[Forms]![RecordSupplierPurchase].[ComboSupplierName])) ORDER BY Product.ProductName;

    Then need to requery the Product combobox after selecting Supplier.

    Getting the correct reference in form code module to the subsubform combobox is tricky but this seems to work:
    Me.Purchase.Form.[PurchaseDetails Subform]!ComboProductID.Requery
    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.

  9. #9
    tweety is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Nov 2012
    Posts
    126
    thanks again for your help, i have added some more bits to that form now, and after adding the above code, the extra bits do not work (in short i added, with the help from the friendly people here multibuy options, so if more then 1 product is sold then discount of my choice can be given)

    the way it works is the product combo box reads the price and displays it in the list, then the price is edited in the purchase field

    can i upload the new copy again please?

    thanks

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    You may do so.
    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
    tweety is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Nov 2012
    Posts
    126
    please see the attached system

    thanks

    this database only has sales on the 9 feb 2012 - if you like to see the system is play!
    Attached Files Attached Files

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Need more specifics. What 'extra bits' do not work? What forms are involved? What happens and what do you want to happen?
    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
    tweety is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Nov 2012
    Posts
    126
    sorry i didnt explain it well, the record purchase orders form, the extra bit that was added by bob fitz on https://www.accessforums.net/forms/r...les-32363.html
    what this does is allow the user to record a discount to products purchased, (multibuy) so in short an extra field was added in the sales details called sold price, this reads the price from selling price from the product table, if 5 items are purchased £1 and be taken off each item as an example, depending on the customer.

    in order for this to work the combo list box product has 2 items the product name and the price, once the code you provided is added this whole multibuy system stops working

    hoping this is clear, but if you have any questions please ask thanks again

  14. #14
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I see the SoldPrice field in table and it is populated for some records but not seeing form or code handling that. How did field get populated?

    Need the db that isn't working to analyse problem code.
    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.

  15. #15
    tweety is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Nov 2012
    Posts
    126
    sorry for the delay. please see attached

    the following code show the price in the list

    Private Sub ComboProductID_AfterUpdate()
    Me.BuyingPrice = Me.ActiveControl.Column(2)
    Quantity.SetFocus
    End Sub
    Attached Files Attached Files

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 10-30-2012, 10:29 AM
  2. Replies: 1
    Last Post: 08-29-2012, 07:25 PM
  3. Replies: 1
    Last Post: 07-11-2012, 08:36 AM
  4. Combo Box values based on preceding selection
    By speckytwat in forum Access
    Replies: 11
    Last Post: 04-27-2011, 11:35 AM
  5. Replies: 1
    Last Post: 08-26-2009, 10:45 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