Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DTPicker: Incrementing Time Value

1 view
Skip to first unread message

Brandon P

unread,
Jan 6, 2010, 11:30:01 PM1/6/10
to
I have a form with the following DTpicker's

InterviewStart (format= "mm/dd/yyyy HH:mm")
InterviewEnd (format= "mm/dd/yyyy HH:mm")

When the user inserts a record, the InterviewStart field updates to Now().

I would like to set the default value of InterviewEnd to be 1.5 hours from
Now(). How does the VBA code look in order to accomplish this?

TIA!

theDBguy at dot

unread,
Jan 6, 2010, 11:40:11 PM1/6/10
to
Hi Brandon,

You might try something like:

Me.InterviewEnd = DateAdd("h", 1.5, Now())

or

Me.InterviewEnd = DateAdd("h", 1.5, Me.InterviewStart

Hope that helps...

John W. Vinson

unread,
Jan 6, 2010, 11:51:15 PM1/6/10
to

I think you'll need to use:

Me!InterviewEnd = DateAdd("n", 90, Me!InterviewStart)

The increment argument to DateAdd needs to be an integer so you can add 90
minutes but not 1.5 hours.
--

John W. Vinson [MVP]

KARL DEWEY

unread,
Jan 7, 2010, 12:06:01 PM1/7/10
to
>InterviewStart (format= "mm/dd/yyyy HH:mm")
>InterviewEnd (format= "mm/dd/yyyy HH:mm")
This is wrong as "m" is used for Months and not Minutes.

Correct would be --
InterviewStart (format= "mm/dd/yyyy HH:nn")
InterviewEnd (format= "mm/dd/yyyy HH:nn")

--
Build a little, test a little.


"John W. Vinson" wrote:

> .
>

Linq Adams via AccessMonster.com

unread,
Jan 7, 2010, 3:58:01 PM1/7/10
to
John is, of course, correct. Help says that it has to be a "numeric
expression" which it defines as a "any expression that can be evaluated as a
number." Then about a page down, after listing all the various intervals and
the rest of the ins and outs of using the function, it mentions that if it
isn't a Long type it'll round it to the nearest whole number.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201001/1

John W. Vinson

unread,
Jan 7, 2010, 6:35:36 PM1/7/10
to
On Thu, 7 Jan 2010 09:06:01 -0800, KARL DEWEY
<KARL...@discussions.microsoft.com> wrote:

>>InterviewStart (format= "mm/dd/yyyy HH:mm")
>>InterviewEnd (format= "mm/dd/yyyy HH:mm")
>This is wrong as "m" is used for Months and not Minutes.

To my moderate surprise, the Format feature is sufficiently context-sensitive
that it interprets the first mm as month and the second as minutes:

?format(now,"mm/dd/yyyy hh:mm")
01/07/2010 16:34


I'd still use n for miNutes and m for Months, though!

theDBguy at dot

unread,
Jan 8, 2010, 4:55:01 PM1/8/10
to
Thanks for the correction, John.


"John W. Vinson" wrote:

> .
>

John W. Vinson

unread,
Jan 8, 2010, 6:39:07 PM1/8/10
to
On Fri, 8 Jan 2010 13:55:01 -0800, theDBguy <thedbguy(at)gmail(dot)com> wrote:

I remember a very confusing afternoon trying to figure out why my DateAdd
wasn't working. IIRC I asked a question here and someone pointed me the right
direction.

0 new messages