Solved

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

Posted on 2006-06-29
7
835 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now