Question Time Query

MOTOWN44

Registered User.
Local time
Today, 00:54
Joined
Aug 18, 2009
Messages
42
does anyone know a method of adding time to a specific date?

the data base has a date received box where users enter the date they received there question

what i want is a query or method that adds the time they entered the date to the end of the string automatically

at the moment ie been playing on with an update query to use the value entered in text 0 + the time as follows

Forms!Form1!Text0 And Time()

but it doesnt work i keep getting the value in the table as 29/12/1899 00:00

ive tried using
Forms!Form1!Text0 & Time()

but then i get a type conversion error but i cant undertand why as the formats all match

i cant use a simple Now() or Today() as the date recieved isnt nessesarily the date the db is filled in

any help would be appreciated

Thanks
 
x = CLng(Date())+CDbl(Time())

x = 40609.5354050926

Therefore

x = format(x ,"dd/mm/yyyy hh:nn am/pm")

Result:

07/03/2011 12:50 pm
 
Assuming Text0 is a Date/time field then surely

Forms!Form1!Text0 + Time()

will work.

Brian
 
a date time varaible is a real number (double)

the integer part of the number is the number of whole days

the decimal part is the fraction of a day.

so, each hour consitutes 1/24 of a day
each minute constitutes 1/1440 of a day (ie 24 x 60)

etc.

so ignoring seconds a 24hour clock time of say 20:35

would be (20*60+35)/1440 = 1235/1440 = 0.857638889 of a day

and this value can be added directly to a date variable, as brian just pointed out
 

Users who are viewing this thread

Back
Top Bottom