Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

two different forms passing parameter to same query

Status
Not open for further replies.

Delindan

MIS
May 27, 2011
203
US
I have two separate forms that will be using some of the same queries. Within those queries I have one parameter which is txtstart that is used in all of the queries. Is it possible to have two separate forms with a textbox called txtstart pass to all of those queries? I am getting an error Access cannot find the name "txtstart" you entered in the expression.

Thanks!
 
How are you using the queries? Are they record sources for forms or reports? If so, don't use any references to controls on forms; use the where condition in code.

I also modify the SQL of saved queries which frees the query from relying on form controls.

Duane
Hook'D on Access
MS Access MVP
 
This is a great idea however it brings into question my entire query structure. Let me explain. I have a primary table that has individual jobs and a related table that has the activity of employees coming and going from that job. The primary table stores job information such as budgeted annual salary, cost center and other various descriptors while the secondary table stores employee name, actual annual salary, start date and end dates of employment. From these tables I developed queries which based on a fiscal year start date, would calculate budget, actual and forecast for a fiscal year with a particular start date. So, given a txtstart the queries would calculate each month using a formula which includes the dateadd function...so the txtstart is used in the individual monthly formulas.

So, given your suggestion and my approach, I'm not sure how I would do that. The particular forms that I am using takes the data from the final query and exports it into an excs el spreadsheet. The first form does it with discount rates and overhead and the other without. I'm thinking of putting a checkbox on one form that allows the user to add in the discount and overhead that way it would be coming off the same form. What do you think?

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top