how do I refer to fields on a form in a query in an adp project?

G

Guest

Hi,

I have converted an mdb project to an adp project. I do have one query that
uses fields as parameters for a query. The old query referred to the field
names on the form as [forms]![Report Date Rng]![Beg Date] .... In the query
that was converted , it refers to them as @forms___Report_Date_Range___Beg)
How do I define the form fields correctly in the new query?

Thanks!!
 
J

Jeff L

Your query should be created as a function in the ADP. In the Begin
Date field of the function, put =@BeginDate. Now go to your form and
open it in design view. Look at the properties of the form. Click the
data tab. There should be a box labeled Input Parameters. In that
box, put @BeginDate = [Forms]![Report Date Rng]![Beg Date] If you have
more that one parameter that you are using, separate them by commas.
Hope that helps!
 
G

Guest

I couldnt get it to work. It worked before I converted this to an ADP.
Here's how it worked in the MDB: the user enters dates in a form. This event
get triggered in the open event of the report:
docmd.openform "report date range",,,,acdialog,"summary report". The
summary report has as it's record source the query that uses the fields in
the form " report date range.

What happens in the ADP project, is that I get prompted twice for the date -
and it seems to go by the dates in the form and ignores the query fields
(begindate, enddate) . But, if I enter nothing for begindate and enddate, I
dont get anything in my report. Im sooo confused. i have no idea how this is
working.
 
J

Jeff L

How are you opening your report? Are you using a command button on a
form or are you doing it manually? You need to have your date range
form open first, then open the report when you have your dates filled
in. In order to pass the parameters, your Data Source must be a
function. You pass the parameters like I said in the first post. I
have done several queries in this way and they work great. It does
take some getting accustomed to though because syntax and procedures
are similar, but not exactly the same.
 
G

Guest

hi,
Im using a button that performs "printreports" that selects the report to
print based on a radio button. DoCmd.OpenReport "Log Summary", PrintMode-
then, in the acual Log Summary report, it calls up a form for the user to
input dates - then the report is displayed. my problem is i get prompted
twice. I thought if i could refer to the actual field name in the query
"[forms]!,etc", that it would work, but I cant figure it out.
 
J

Jeff L

As far as I know, that will not work the way you are doing it because
your report is looking for those values before the form is opened.
Since it can't find them, it prompts you for them.

hi,
Im using a button that performs "printreports" that selects the report to
print based on a radio button. DoCmd.OpenReport "Log Summary", PrintMode-
then, in the acual Log Summary report, it calls up a form for the user to
input dates - then the report is displayed. my problem is i get prompted
twice. I thought if i could refer to the actual field name in the query
"[forms]!,etc", that it would work, but I cant figure it out.

Jeff L said:
How are you opening your report? Are you using a command button on a
form or are you doing it manually? You need to have your date range
form open first, then open the report when you have your dates filled
in. In order to pass the parameters, your Data Source must be a
function. You pass the parameters like I said in the first post. I
have done several queries in this way and they work great. It does
take some getting accustomed to though because syntax and procedures
are similar, but not exactly the same.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top