Jump to content

SQL Dates Between


SunnySK

Recommended Posts

Hiii 

I am working on MS Access 2013.

My data contains a subform with 'Failure-Dates' column in it.

Now I want to add two text boxes in Main form as 'Date From' and 'Date to' and also add Search button . So if I select any dates in this columns I will get data according to these dates. I want data between these two dates. But my dates are not fixed. Any user can insert any date according to his will.

I added all this but when i click on search button, its not working or some errors are displayed.

Peae help me out with this error. 

Link to comment
Share on other sites

What's your current SQL code looking like?

What are the errors?

For all we know your computer could be on fire, and that's why it doesn't complete the query.

 

 

However, this doesn't sound too difficult, replace the "date"s below to your form references (too long ago since I did MS access to remember how it works)

SELECT *
FROM table
WHERE date BETWEEN "date_from" AND "date_to"

 

Link to comment
Share on other sites

Hello,
You can simply use the between clause to find the records between the given dates. SQL query can be written as follows:
 

SELECT * FROM TABLE
WHERE Failure-Dates IS BETWEEN FROM_DATE AND TO_DATE

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...