so you can check for range of numebrs as well?
Main Topics
Browse All TopicsI have a form that contains 4 fields, these fields are called "From", "To", "StartDate" and "EndDate". When the form is submitted it needs to query the Access database and return all results that land within the bounds of the "StartDate" and "EndDate".
Problem is I can not get the SQL query right though, below is what I thoguth waht correct....
SELECT * FROM Tbl_main WHERE (Date >= MMColParam AND Date <= MMColParam2) AND From = 'MMColParam3' AND To = 'MMColParam4' ORDER BY Date Asc, Day Asc
I am sure I should be using some sort of RANGE or IN function.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
hmmm I tried the above but still no luck.
I tried the query using test data that I know is in the database but still the query retuedn no results.
The actual SQL ni the asp page is as follows, I actually think I may have missed some punctuation out around the dates.
<%
rsFlights__MMColParam = Request.Form("StartDate")
rsFlights__MMColParam2 = Request.Form("EndDate")
rsFlights__MMColParam3 = Request.Form("From")
rsFlights__MMColParam4 = Request.Form("To")
%>
<%
Dim rsFlights
Dim rsFlights_numRows
Set rsFlights = Server.CreateObject("ADODB
rsFlights.ActiveConnection
rsFlights.Source = "SELECT * FROM Tbl_main WHERE From = '" + Replace(rsFlights__MMColPa
rsFlights.CursorType = 0
rsFlights.CursorLocation = 2
rsFlights.LockType = 1
rsFlights.Open()
rsFlights_numRows = 0
%>
SimonWGoldsmith ,
Try this :
In MS SQL :
rsFlights.Source = "SELECT * FROM Tbl_main WHERE From = '" + Replace(rsFlights__MMColPa
In Access :
rsFlights.Source = "SELECT * FROM Tbl_main WHERE From = '" + Replace(rsFlights__MMColPa
Regards
x_com
Business Accounts
Answer for Membership
by: koushksPosted on 2003-10-01 at 02:35:29ID: 9465263
Try the BETWEEN clause. It goes like this:
SELECT * FROM Tbl_main WHERE From = 'MMColParam3' AND To = 'MMColParam4'
AND Date BETWEEN MMColParam AND MMColParam2
ORDER BY Date Asc, Day Asc
The BETWEEN clause can be used for all datatypes, not only for the date type.
Hope it helps.