Need a 1pm catch

  • Thread starter Thread starter Bonnie
  • Start date Start date
B

Bonnie

Hi there. Using A02 on XP. Have a field for [DateDep] that
is filled in with Date() when a [CSR] is selected on my
form. How can I have it use today if it's prior to 1pm and
tomorrow's date if it's after 1pm?

Would appreciate any help or advice on this. Thanks in
advance!
 
Bonnie said:
Hi there. Using A02 on XP. Have a field for [DateDep] that
is filled in with Date() when a [CSR] is selected on my
form. How can I have it use today if it's prior to 1pm and
tomorrow's date if it's after 1pm?

Would appreciate any help or advice on this. Thanks in
advance!

I'm not sure what you mean when you say "a [CSR] is selected", but if
you currently have code that says:

Me!DateDep = Date

you can change it to say:

If Time < #1:00 PM# Then
Me!DateDep = Date
Else
Me!DateDep = DateAdd( "d", 1, Date)
End If
 
Dirk!!! You da man! Exactly what I was looking for.
Sorry 'bout the fog, just meant that it runs after another
field ([CSR]) is updated. Wasn't sure how to catch 1pm
with the LOOONNNGGGG date including time. Thanks bunches!!!

B
-----Original Message-----
Hi there. Using A02 on XP. Have a field for [DateDep] that
is filled in with Date() when a [CSR] is selected on my
form. How can I have it use today if it's prior to 1pm and
tomorrow's date if it's after 1pm?

Would appreciate any help or advice on this. Thanks in
advance!

I'm not sure what you mean when you say "a [CSR] is selected", but if
you currently have code that says:

Me!DateDep = Date

you can change it to say:

If Time < #1:00 PM# Then
Me!DateDep = Date
Else
Me!DateDep = DateAdd( "d", 1, Date)
End If

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


.
 
Dirk,

After my initial jubilation, I wondered, is there a way to
go to the next business day if plus one lands on Sat?

Don't mean to press my luck, but thought I'd try.

Thanks alot!!!
-----Original Message-----
Hi there. Using A02 on XP. Have a field for [DateDep] that
is filled in with Date() when a [CSR] is selected on my
form. How can I have it use today if it's prior to 1pm and
tomorrow's date if it's after 1pm?

Would appreciate any help or advice on this. Thanks in
advance!

I'm not sure what you mean when you say "a [CSR] is selected", but if
you currently have code that says:

Me!DateDep = Date

you can change it to say:

If Time < #1:00 PM# Then
Me!DateDep = Date
Else
Me!DateDep = DateAdd( "d", 1, Date)
End If

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


.
 
Bonnie said:
Dirk,

After my initial jubilation, I wondered, is there a way to
go to the next business day if plus one lands on Sat?

Don't mean to press my luck, but thought I'd try.

If you want to get fancy, copy the code at

http://www.mvps.org/access/datetime/date0012.htm

into a new standard module, and then use:

If Time < #1:00 PM# Then
Me!DateDep = Date
Else
Me!DateDep = dhNextWorkdayA(Date)
End If


A crude approach would be:

If Time < #1:00 PM# Then
Me!DateDep = Date
Else
If Weekday(Date) = vbFriday Then
Me!DateDep = DateAdd( "d", 3, Date)
Else
Me!DateDep = DateAdd( "d", 1, Date)
End If
End If
 
Once again Dirk, you have answered my prayers. Thank you
VERY VERY much for the Time function, I've never used it,
but I will now! Thanks for participating in these
newsgroups, you are one of my tutors.
 
Back
Top