Solved

Parameter query question (ADP front end, SQL Server 2005 backend)

Posted on 2006-06-29
7
838 Views
Last Modified: 2013-12-05

I used to write parameter queries in Access MDB easily enough but have recently migrated at a ADP front-end and SQL Server 2005 back end, which I have very little experience of.

Simply, I am trying to run a report in the Access ADP which is based on a SQL view which contains dates, in a column named [Date]. I want to prompt the user for a date range and return the filtered records.

What is the best way to achieve this please?

(I am currently returning all records to the report by specifying the following in the Record Source property of the report: SELECT * FROM viewMaterialsConsumed)
0
Comment
Question by:alexjlewis
  • 3
  • 2
7 Comments
 
LVL 12

Accepted Solution

by:
Einstine98 earned 125 total points
ID: 17008352
SELECT *
FROM viewMaterialsConsumed
WHERE [DATE] Between @StartDate and @EndDate

@StartDate and @EndDate are variables that you have to define and pass back to the stored procedure/query
0
 
LVL 1

Author Comment

by:alexjlewis
ID: 17008929
Thanks Einstine98, but I already tried that, and although the report does ask for the dates when opening it, the records are not filtered - it ruturns all records.

Any ideas?
0
 
LVL 1

Author Comment

by:alexjlewis
ID: 17008999
OK - it IS filtering but...

If I enter a date like 15/01/2006, it accepts it as 15th January (intended), but if i enter 2/01/2006, it think I mean 1st February, not the 2nd of January as intended.

How can I resolve this?
0
 
LVL 1

Author Comment

by:alexjlewis
ID: 17009343
Ok, got it. I need to convert to the correct date time format with the following included in my SQL statement:

WHERE     (Date BETWEEN CONVERT(DATETIME, @[Start Date], 103) AND CONVERT(DATETIME, @[End Date], 103))

Thanks anyway for your help.
0
 
LVL 12

Expert Comment

by:Einstine98
ID: 17013176
Cool... :-)
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Viewers will learn how the fundamental information of how to create a table.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question