I have a user selected start time and a user selected end time defined as follows:
Public STime As Date = Format(MyDate, "MM/dd/yyyy")
Public ETime As Date = Format(MyDate, "MM/dd/yyyy")
Public MyDate As Date
So the user selects dates from calendars, and the Unit comes from a dropdown list.
I need to base a select statement on the selections made by the user.
"SELECT * FROM Events WHERE UnitNumber = '" & Unit.Text & "'
AND StartTime <= TO_DATE('" & STime & "', 'MM/DD/YYYY')
AND EndTime >= TO_DATE('" & ETime & "', 'MM/DD/YYYY')"
This returns all records for the unit selected, not the records with dates between the start time and end time.
Am I using the TO_DATE function properly?
Do I even need to use it since STime and ETime are already dates?
Any suggestions for changes?
Help gets you stars!
Thanks,
Chilly442
Public STime As Date = Format(MyDate, "MM/dd/yyyy")
Public ETime As Date = Format(MyDate, "MM/dd/yyyy")
Public MyDate As Date
So the user selects dates from calendars, and the Unit comes from a dropdown list.
I need to base a select statement on the selections made by the user.
"SELECT * FROM Events WHERE UnitNumber = '" & Unit.Text & "'
AND StartTime <= TO_DATE('" & STime & "', 'MM/DD/YYYY')
AND EndTime >= TO_DATE('" & ETime & "', 'MM/DD/YYYY')"
This returns all records for the unit selected, not the records with dates between the start time and end time.
Am I using the TO_DATE function properly?
Do I even need to use it since STime and ETime are already dates?
Any suggestions for changes?
Help gets you stars!
Thanks,
Chilly442