DateAdd

T

THE_RAMONES

I'm trying to figure out a way to this without adding 7 queires to my macro..

I have a data set that has a column for Date and Time.. Below is an example

row_date interval split callsAnswered
27-Mar-08 10:00:00 PM 822 0

The time is in MDT - Mountain and I need to convert to EST.. I'm using a
dateadd to add 2 hours (DateAdd("n",+120,[interval])).. How do I round up the
day (10pm converts to 12am) without adding an additinal column.. I was
thinking to add a column where i add an IIF(Interval >=12:00am and <=1:30am,
1,0) Then adding that amount to the date field... Etc...

Anyways I know how to do it however its going to take about 7 queries and
one append query to prevent dups... Any thoughts...

Ramon
 
K

KARL DEWEY

It seems to me that the easiest way is to combine your date and time in a
single field. Then one DateAdd would do it.
 
F

fredg

I'm trying to figure out a way to this without adding 7 queires to my macro..

I have a data set that has a column for Date and Time.. Below is an example

row_date interval split callsAnswered
27-Mar-08 10:00:00 PM 822 0

The time is in MDT - Mountain and I need to convert to EST.. I'm using a
dateadd to add 2 hours (DateAdd("n",+120,[interval])).. How do I round up the
day (10pm converts to 12am) without adding an additinal column.. I was
thinking to add a column where i add an IIF(Interval >=12:00am and <=1:30am,
1,0) Then adding that amount to the date field... Etc...

Anyways I know how to do it however its going to take about 7 queries and
one append query to prevent dups... Any thoughts...

Ramon

Why are you adding 120 minutes instead of 2 hours?
Include the date as well as the time in the field.

Get rid of either the Row_Date field or the Interval field.
Include the date and time in whichever field you keep.
Then add 2 hours.

DateAdd("h",2,[FieldName])

Access will take care of the rest.

If you wish to display the time and date in different controls, simply
set the Format property of the control that contains the Datefield
data to:
dd-mmm-yy

The other control should be an unbound control.
Set it's control source to
=Format([DateField],"hh:nn:ss AM/PM")

All Date and Time data must be entered into the one control, i.e.

3/27/2008 10:00 PM
 
G

George Nicholson

Interval: DateAdd("h",2,[Interval])
RowDate: DateValue(DateAdd("h",2,[RowDate]+[Interval]))
 

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