Adding Hours using DateAdd()

J

Jacinda

I have a table that tracks like a time clock for employees... I want to
create a form that gives the abilty to the user to add in hours for vacation
time...

A form where you can enter the type of time, the date of the time and the
number of hours for vacation, sick or other time...

I have the form, but I'm trying to set up the append query to add the hours
to the Ttime table...

So for example the user will enter : VAC , 04/07/09, 6 (in the hours
field)... I have a box that will put 12:00:00 as the start time, I just need
the query to add 6 hours to it and append a start time and end time to my
Ttime table.

DateAdd() seems to want to have a fixed number but I need something that
will be a bit more flexible...

Can someone point me in the right direction.
 
M

Marshall Barton

Jacinda said:
I have a table that tracks like a time clock for employees... I want to
create a form that gives the abilty to the user to add in hours for vacation
time...

A form where you can enter the type of time, the date of the time and the
number of hours for vacation, sick or other time...

I have the form, but I'm trying to set up the append query to add the hours
to the Ttime table...

So for example the user will enter : VAC , 04/07/09, 6 (in the hours
field)... I have a box that will put 12:00:00 as the start time, I just need
the query to add 6 hours to it and append a start time and end time to my
Ttime table.

DateAdd() seems to want to have a fixed number but I need something that
will be a bit more flexible...


Just use your fields in DateAdd:

DateAdd("h", [hours field], [Start time])

Note that putting the date and time in different fields
makes it difficult to work with them, especially if start
and end times can ever be in different days.
 
N

Noëlla Gabriël

hi,

try something as = dateadd("h",[fieldname with number hours],[field with
start time])
 
J

Jacinda

Ok... I think I see what I did wrong...

Thank you.
--
-Jacinda


Marshall Barton said:
Jacinda said:
I have a table that tracks like a time clock for employees... I want to
create a form that gives the abilty to the user to add in hours for vacation
time...

A form where you can enter the type of time, the date of the time and the
number of hours for vacation, sick or other time...

I have the form, but I'm trying to set up the append query to add the hours
to the Ttime table...

So for example the user will enter : VAC , 04/07/09, 6 (in the hours
field)... I have a box that will put 12:00:00 as the start time, I just need
the query to add 6 hours to it and append a start time and end time to my
Ttime table.

DateAdd() seems to want to have a fixed number but I need something that
will be a bit more flexible...


Just use your fields in DateAdd:

DateAdd("h", [hours field], [Start time])

Note that putting the date and time in different fields
makes it difficult to work with them, especially if start
and end times can ever be in different days.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top