confused and lost

G

GovCoder

Okay, I've read and tried dozens of articles and suggestions about how to use
parameters, how it's done, and every time I try something, is comes up as not
working. It's a report driven by a parameter driven query. The way the
parameters are produced is to assign VBA date values to text boxes on a form,
from which the query reads the parameters using something like...

forms!frmReports!txtFirstBegin.value

I've been trying to use the Between And operator since I have two dates. It
seems to never work. I even tried entering parameters into the parameter
screen on the query, didn't work. I've tried a where variable on a
DoCmd.OpenReport statement. Didn't work. Does this even work anymore with
Access or has Microsoft made it impossible to do this now?
 
J

John Spencer

Well, it would help if you expanded on what you mean by "mot working".

No records returned?
Wrong records returned?
Syntax error message or other error message? What is the error message?

I suggest you post the SQL (View: SQL) of the query that is not working so it
can be examined.

As a guess, declaring your parameters in the query might solve the problem.

Open the query in design mode
Select Query: Parameters from the Menu
Fill in the EXACT name of the parameter in column 1
Select the data type of the parameter in column 2
Repeat for the other parameters.

Also, don't use the value property. Just use
forms!frmReports!txtFirstBegin

If you choose to edit the query in SQL view, you would add the parameter
section to the beginning of the query. It would look something like the
following. If your parameters are something besides dates you will have to
use the proper data types in place of DateTime.

Parameters forms!frmReports!txtFirstBegin DateTime,
forms!frmReports!txtFirstEnd DateTime;
SELECT ....
FROM ....


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 
G

GovCoder

I did, sorry, I posted a reply that included the SQL back to John Spencer but
I may have done it wrong and posted a general comment so I'll try again.

golfinray said:
In your query criteria, try Between [ ] and [ ]
--
Milton Purdy
ACCESS
State of Arkansas


GovCoder said:
Okay, I've read and tried dozens of articles and suggestions about how to use
parameters, how it's done, and every time I try something, is comes up as not
working. It's a report driven by a parameter driven query. The way the
parameters are produced is to assign VBA date values to text boxes on a form,
from which the query reads the parameters using something like...

forms!frmReports!txtFirstBegin.value

I've been trying to use the Between And operator since I have two dates. It
seems to never work. I even tried entering parameters into the parameter
screen on the query, didn't work. I've tried a where variable on a
DoCmd.OpenReport statement. Didn't work. Does this even work anymore with
Access or has Microsoft made it impossible to do this now?
 
G

GovCoder

Hi John

I may have posted a general comment and not a reply back to you as I had
intended. So, just to reply again, I mean not returning any data by "not
working". It comes back with field names and pages numbers.

Here is the SQL to the query. By the way, I only used the value property
when assigning the text boxes on the form, not in the query itself.

SELECT AdultCommunityEducation.FVF100Adults, "Adults/General Population" AS
[Community Education], Sum(AdultCommunityEducation.FVF100Numberpresentations)
AS [Total Number of Presentations],
Sum(AdultCommunityEducation.FVF100AdultParticipants) AS [Total Number of
Participants]
FROM AdultCommunityEducation
WHERE (((AdultCommunityEducation.FVF100Presentationdate) Between
CDate([Forms]![frmReports]![txtFirstBegin]) And
CDate([Forms]![frmReports]![txtFirstEnd])))
GROUP BY AdultCommunityEducation.FVF100Adults, "Adults/General Population";

I have tried using the parameters screen to enter the parameters as you
suggested, before I ever posted my question. That didn't work. However, it
may be I was going about it the wrong way. In those parameters, I used the
forms!frmReports!txBoxName format, the same as in the query's Between And
operator. Maybe I shouldn't have done that?

Thanks John!
 

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