Question How to set a field to be showing Hour, Not date?

UnrealEnvy

Registered User.
Local time
Today, 06:35
Joined
Jul 15, 2009
Messages
35
Hello everyone.
In my database, I've got a journal table, in which I have a field: Hour
Thing is, I would like my customer to be able to type hours AND I will be able to make a query that will pop up a msb box IF the current time is earlier then the Hour field.
Problem is, when I put "Date/Time" field type, and set the format to short, it still shows the date picker, and let me choose date but not hour.

How can I change that field so I can type in it an hour like 13:30, but to be also able to make a query on it?

Thanks in advance.
 
You need to set the field to "Short Time" and not "Short Date".

You can use the function Now() in your query to return the exact date and time the function is called. To only get the current time use the formulae Now()-Int(Now()) - the function increments by 1 as each day passes and we only need the fraction of today to get the time.

Now you can use an IIf formulae in your query to say IIf([fld_Hour]>Now()-Int(Now()),"Time entered is later than Now - acceptable","Time entered is earlier than Now - it is in the past")

Or any If statement doing the same in VBA.
 

Users who are viewing this thread

Back
Top Bottom