Page 1 of 1

query date and time

PostPosted: Sat Dec 20, 2014 12:51 pm
by yanzco
im having a problem with querying dates.. in accessdatabase 2003

(for my attendance)

which was solve with placing # to front and end of the date variable
dbpQuery "Minindaldb" "Attendance" "SID = [ASID] AND ADate = #[DateToday]#

now im having problem with the time

for some reason..
when i setvar [Minindaldb.attendance.timein] [Time]

it stores "8:30:10 AM" and shows "8:30:10 AM" to text with [Minindaldb.attendance.timein]

but when i switch to another person..
and change back to previous person..

the [Minindaldb.attendance.timein] shows 12/30/1899 8:30:10 AM

how can i make it just show the time..

and if i dbpquery a time.. it shows an error
even doing dbpQuery "Minindaldb" "Attendance" "SID = [ASID] AND ADate = #[DateToday]# AND ATime = #[Timein]#
doesnt work...

how to query time?..

Re: query date and time

PostPosted: Sat Dec 20, 2014 1:12 pm
by Gaev
yanzco:

According to this web page from Microsoft, there is no field in MS Access database that only stores the "time of day".

Also, see the Help information for dbpCreateTable ... where it states ...
Time
Time. This type is not supported by MS Access, use DateTime instead.**


how can i make it just show the time..

You can store it in a String type field ... and if you need to do math (like sort or calculate difference) on this field, you can store "the number of minutes/seconds past midnight" in an Integer (–32,768 and 32,767) or BigInt (–2,147,483,648 and 2,147,483,647) field ... then, you can display the String field to the user ... and when required, use the numeric field to do the math.