how i should referral RowSource query to a subform

eldarbs

New member
Local time
Today, 04:23
Joined
Aug 25, 2012
Messages
9
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 puting 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.
 
Thanks for sharing bob. Excellent resource, should be helpful.
 
bigggg Thanks !! bob. it was realy helpful.
the right syntax is : [MySubformControlName].Form.[MyControl]
and for me code is this one :

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];"

thanks again.
solves !!
 

Users who are viewing this thread

Back
Top Bottom