AboutScottgem Expertise I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.
Experience I've been designing databases for over 15 years working with dBase, FoxPro, Approach and Access.
Organizations Author of Microsoft Office Access 2007 VBA Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing
I'm sure this is a simple thing but I'm having trouble finding my way around it.
I have a stored query. I would like to run this query from two different command buttons which will prompt the user to input different parameters.
As an example:
SELECT M_TRequests.Trial_Request_ID, M_Product_Detail.MFG_Code, [Routingcommentsorig].[Pt Desc1] & " " & [Pt Desc2] AS Expr1
FROM M_TRequests, Routingcommentsorig INNER JOIN M_Product_Detail ON Routingcommentsorig.Part = M_Product_Detail.MFG_Code;
Pressing one command button would prompt the user to input a MFG Code and the other to input a Part.
At the moment I have two stored queries with the same fields just a different criteria. I would like to eliminate one of these and just use the one query and prompt the user to input a parameter depending on which command button is pressed.
Please help, thanks!
Answer I would have the user input the criteria on the FORM. (I rarely use parameter prompt queries). Add a WHERE clause to your query:
WHERE MFG Like Forms!formname!cboMFGCode & "*" AND Part Like Forms!formanme!cboPart & "*"
On the form, add two comboboxes to select the MFGCode and Part. Then add a button to run the query.
Hope this helps,
Scott<>
Microsoft Access MVP 2007
Author: Microsoft Office Access 2007 VBA