Hello!
I'm new here but I've used this forum quite extensively in the past to figure out answers to my questions. I have a moderate amount of Access experience, and I'm using Access 2010, (though the database in question is 2002 - 2003 format). I looked through this forum and have searched on google and found a few answers that were close to my situation, but nothing that truly dealt with the problem. Hopefully I can explain it in a way that isn't too confusing.
I have a form (called Search) that has two combo boxes on it that user can choose some values from and then a subform (called Parts Header subform) displays the results from a table. This works great.
What I want to do is use a field from the results of that subform to query a different table and display that. Though the tables are different, there are definitely matches between them. [Before you say I'm repeating information needlessly these tables actually come from two different databases my company uses and I have no control over anything about those data sets, only my interface with them.]
Here is the SQL I have right now:
For example if my subform has results in the BASE PN field of a, b, c, d, e it will only display results for a in the query when it pops up but I want it to use all five criteria.
Just to prove that I've done a bit of homework on this already, I've already read this thread: (It won't let me post links but it's post 1300908 that deals with filter by form) but I really need my results to be in a query and not a report and when I tried to adjust the information in that thread I found out you couldn't pass stWhere to a query.
I also read this thread: (Post 196581) which deals with the same problem I'm having, but the answer he came up with was some looping code and I have to believe there's an easier way to handle this.
Thanks so much for reading my mini-novel!
CM
I'm new here but I've used this forum quite extensively in the past to figure out answers to my questions. I have a moderate amount of Access experience, and I'm using Access 2010, (though the database in question is 2002 - 2003 format). I looked through this forum and have searched on google and found a few answers that were close to my situation, but nothing that truly dealt with the problem. Hopefully I can explain it in a way that isn't too confusing.
I have a form (called Search) that has two combo boxes on it that user can choose some values from and then a subform (called Parts Header subform) displays the results from a table. This works great.
What I want to do is use a field from the results of that subform to query a different table and display that. Though the tables are different, there are definitely matches between them. [Before you say I'm repeating information needlessly these tables actually come from two different databases my company uses and I have no control over anything about those data sets, only my interface with them.]
Here is the SQL I have right now:
SELECT dbo_RepairDB.[Sales Order], dbo_RepairDB.[Base Part Number], dbo_RepairDB.Description, dbo_RepairDB.Site, dbo_RepairDB.[Parent Name], dbo_RepairDB.[Sale Tot], dbo_RepairDB.Invoiced
FROM dbo_RepairDB
WHERE (((dbo_RepairDB.[Base Part Number])=[Forms]![Search]![Parts Header subform].[Form]![BASE PN]) AND ((dbo_RepairDB.Year)>2011));
This query does work, but ONLY for the first record in the subform.FROM dbo_RepairDB
WHERE (((dbo_RepairDB.[Base Part Number])=[Forms]![Search]![Parts Header subform].[Form]![BASE PN]) AND ((dbo_RepairDB.Year)>2011));
For example if my subform has results in the BASE PN field of a, b, c, d, e it will only display results for a in the query when it pops up but I want it to use all five criteria.
Just to prove that I've done a bit of homework on this already, I've already read this thread: (It won't let me post links but it's post 1300908 that deals with filter by form) but I really need my results to be in a query and not a report and when I tried to adjust the information in that thread I found out you couldn't pass stWhere to a query.
I also read this thread: (Post 196581) which deals with the same problem I'm having, but the answer he came up with was some looping code and I have to believe there's an easier way to handle this.
Thanks so much for reading my mini-novel!
CM