Help with Where conditions using AND and OR

connerlowen

Registered User.
Local time
Today, 05:33
Joined
May 18, 2015
Messages
204
HI,

I have a query that is the row source for a combo box on a form "NewPartF". This form can be a subform on form "NewPartF" or it can be a sub-subform on form "NewAssemblyF". I need the combo box to be filtered whether it is a subform or a sub-subform. When on the subform Access asks me for the parameters for the sub-subform and I do not want it to. How do I get rid of this? Any help would be greatly appreciated. If you need any further clarification please ask and I will do my best to clarify.

I will include my SQL Statement below.

SELECT OptionMetalsListQ.MetalsID, OptionMetalsListQ.PreciousOrBase, OptionMetalsListQ.Metals, OptionMetalsListQ.DateOfPrices
FROM OptionMetalsListQ
WHERE (((OptionMetalsListQ.PreciousOrBase)=[Forms]![NewPartF]![subNewMetalF]![cboPreciousOrBase]) AND ((OptionMetalsListQ.DateOfPrices)=[Forms]![NewPartF]![subNewMetalF]![txtDateOfPrice])) OR (((OptionMetalsListQ.PreciousOrBase)=[Forms]![NewAssemblyF]![subNewPartF]![subNewMetalF]![cboPreciousOrBase]) AND ((OptionMetalsListQ.DateOfPrices)=[Forms]![NewAssemblyF]![subNewPartF]![subNewMetalF]![txtDateOfPrice]));


Thanks,

Conner Owen
 
Fastest solution is to make 3 copy subform object and attached each copy to its parent form, then just modify the sql of each copy.
 
If I do that will it still write the information into the same ONE table/query that I need?

Edit:

This solution will not work for my problem. the form NewMetalF is always a subform of the form NewPartF. however the form NewPartF can be a single form or a subform to the form NewAssemblyF. therefore the form NewMetalF must remain as only one form. Thank you for the Reply though.
 
Last edited:
yes it will write on same talbe. What you only modify is the where clause on your sql string for each copy making sure to point to the correct parent!subform.
 

Users who are viewing this thread

Back
Top Bottom