G
Guest
I have a database that keeps track of student discipline. In it, I have a
tbldefaultvalues that contains information that doesn't change that I pull
drop down lists from. One field is called "Time" and I have populated it
with 15 minute increments from 6:00 AM to 8:00 PM (formatted as medium time).
I have a form that has a start date and end date and a start time (called
starttime) and end time (called endtime) that users can use the combo box to
pick the times.
I then have a query that should pull all of the referrals between the start
date and end date and the times. The date part works fine as it is has for
two years. I just changed the time from a single time (which works) to a
"between" time. Here is the sql I have set up:
SELECT[infractions archive].*
From [infractions archive]
where [time] between [forms]![search form]![starttime] and [forms]![search
form]![endtime] and
[date] Between [Forms]![Search form]![Start Date] And [Forms]![Search
form]![End Date]
UNION ALL select [infractions].*
From [infractions]
where [time] between [forms]![search form]![starttime] and [forms]![search
form]![endtime] and [date] Between [Forms]![search form]![Start Date] And
[Forms]![search form]![End Date]
ORDER BY [date];
This obviously pulls from a union of current infractions and archived
infractions. Again, it works if I use only one time (say the starttime
field) but the between is not working.
Any suggestions?
tbldefaultvalues that contains information that doesn't change that I pull
drop down lists from. One field is called "Time" and I have populated it
with 15 minute increments from 6:00 AM to 8:00 PM (formatted as medium time).
I have a form that has a start date and end date and a start time (called
starttime) and end time (called endtime) that users can use the combo box to
pick the times.
I then have a query that should pull all of the referrals between the start
date and end date and the times. The date part works fine as it is has for
two years. I just changed the time from a single time (which works) to a
"between" time. Here is the sql I have set up:
SELECT[infractions archive].*
From [infractions archive]
where [time] between [forms]![search form]![starttime] and [forms]![search
form]![endtime] and
[date] Between [Forms]![Search form]![Start Date] And [Forms]![Search
form]![End Date]
UNION ALL select [infractions].*
From [infractions]
where [time] between [forms]![search form]![starttime] and [forms]![search
form]![endtime] and [date] Between [Forms]![search form]![Start Date] And
[Forms]![search form]![End Date]
ORDER BY [date];
This obviously pulls from a union of current infractions and archived
infractions. Again, it works if I use only one time (say the starttime
field) but the between is not working.
Any suggestions?