The downside of my celebrity is that I cannot go anywhere in the world without being recognized. It is not enough for me to wear dark sunglasses and a wig. The wheelchair gives me away.
I have created a search form that searches my ambulance run table for a variety of data. One of the pieces of data in the table is the time of day the call was dispatched. I would like the ability to check which runs were dispatched let's say after 10pm or between two times, something like that. I am have defined two variables in the form, "PageOutMin" and "PageOutMax" and check them against the field "PageOutTime" in the RunT table. I can't seem to avoid a syntax 3075 error when I enter 10PM or 22:00 into those fields on the search form. Could you please shed some light on this? I know it's a simple thing but I just can't seem to figure it out...
Thanks very much.
Reply from Richard Rost:
That syntax error usually means that your criteria is invalid. It usually comes up when you forget to put a date field inside of # symbols in SQL queries (or quotes for strings) like this:
MySQL = "SELECT * FROM OrderT WHERE StartDate>1/1/2001"
When it should be:
MySQL = "SELECT * FROM OrderT WHERE StartDate>#1/1/2001#"
Now if you just want to check the TIME and you don't care about the date portion, you can separate out the HOUR of the date field using the HOUR function:
MyHOUR = HOUR(SomeDate)
Now you have a value from 0 to 23 that you can use for your reporting.
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Access Search Seminar.