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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use of Form to Satisfy Query Prompt 2

Status
Not open for further replies.

EBox

Programmer
Dec 5, 2001
70
US
Hello:

I have a query (Percentages 2)which uses about 6 sub-queries, each of which have a prompt of [StartDate] and [EndDate], so I can aggrgate individual table data into one master table.

I then have a form, Form1, which points to Percentages 2 so when I open the form, it asks for a [StartDate] and [EndDate], and then displays the data from the date range I want. (so far, so good!)

However, I want to set up a command button in the form to open another query with the same date range. Unfortunately, when I try to run it, it again asks me for a [StartDate] and [EndDate].

Although I can just re-enter the date range, its a pain to have to enter it twice. Is there a way I can set this up so that I don't have to re-enter the data range for any sub-queries that I want to run in the form AFTER the initial query?

Many thanks for any help you can provide...

EBox
 
instead of using a query prompt:

SELECT .... WHERE SomeDate > [Please enter Date]

enter the value in a edit box of some kind on a form and reference the value on the form:

SELECT .... WHERE SomeDate > FormName!edBoxName

HTH



Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for anyone working with databases: The Fundamentals of Relational Database Design
 
Can't you use a fully qualified reference to a control on a form as a criterion in a query? I think you can. If not, you can certainly write a function that grabs the appropriate value from the form and use that as the criterion. But try it first with [forms]![myForm]![myControl] or [myForm]![myControl].

Jeremy

---
Jeremy Wallace
METRIX Lead Developer
Fund for the City of New York
http:// metrix . fcny . org
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top