Results 1 to 3 of 3
  1. #1
    eldarbs is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    17

    how i should referral RowSource query to a subform

    i'm traying to find the right query syntax for a subfrom


    i have an "orders" main form and "order details subform" - as a Continuous frorm,
    in that subform i have 3 combo box that i succeeded to make a good working filtering of one on the others
    by putting this code on the enter event and the exit event :

    Me.c_cmb.RowSource = "SELECT Products.ID, Products.[Product Name]FROM [Products Category]INNER JOIN Products ON [Products Category].[Product Category ID]= Products.[Product Category ID] WHERE ((([Products Category].[Product Category ID]) = [Forms]![Order Details singel].[combobox_name]))GROUP BY Products.ID, Products.[Product Name];"

    it's works fine on a singel form (and also Prevents from the other rows to change vereytime i fill a new row of bombobox in the singel conuinuius form)
    now the problem is when i do the same on the order details subform - i get an error massage box from access that asking from me to insert the value
    instad of taking it from the first combobox like it doing well in the same thing on the single form.
    i think that i have a mistake in the referral to the subform in that code that i put on thae same way to the subfrom :

    Me.c_cmb.RowSource = "SELECT Products.ID, Products.[Product Name]FROM [Products Category]INNER JOIN Products ON [Products Category].[Product Category ID]= Products.[Product Category ID] WHERE ((([Products Category].[Product Category ID]) = [Form]![Order Details form]![Order Details subform].[combobox_name]))GROUP BY Products.ID, Products.[Product Name];"

    can someone please chack the code if this is the way that i should referral RowSource query to a subform.
    thanks.

  2. #2
    smithse is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2012
    Posts
    37
    Hi eldarbs,

    Your question is a bit hard to understand. Can you attach a sample of your db for us to look at? It appears that you might be trying to obtain the value of the combobox in a continuous subform, from the parent form..?

  3. #3
    eldarbs is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    17
    hey first thanks but i received a refernce from that links that solved my question :

    http://www.btabdevelopment.com/ts/refer2sfrms

    http://www.btabdevelopment.com/ts/ewtrhtrts

    on the subfroms there is three combobox that get values direct from tables and i insert where condision in the query to make filter from one combobox to the next one, like : product category in the firs one and then the related product on the second cmb, and the relataed supplier on the third cmb.

    just i had problem what is the right syntax of the event code that refer to the subforms combobox.
    so the right syntax for that is :

    Me.Product_ID.RowSource = "SELECT Products.ID, Products.[Product Name]FROM
    [Products Category]INNER JOIN Products ON [Products Category].[Product Category
    ID]= Products.[Product Category ID] WHERE ((([Products Category].[Product
    Category ID]) = Forms![Order Details]![sbfOrderDetails].Form![combobox name]))GROUP BY Products.ID,
    Products.[Product Name];"

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

Similar Threads

  1. RowSource question
    By ermcc in forum Access
    Replies: 3
    Last Post: 07-11-2012, 08:16 AM
  2. .RowSource Combo
    By white_flag in forum Access
    Replies: 1
    Last Post: 09-06-2011, 07:59 AM
  3. SQL Rowsource
    By DSTR3 in forum Queries
    Replies: 2
    Last Post: 12-06-2010, 11:06 AM
  4. Replies: 1
    Last Post: 11-01-2010, 06:59 PM
  5. Replies: 0
    Last Post: 08-26-2009, 11:51 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