Tilted Forum Project Discussion Community  

Go Back   Tilted Forum Project Discussion Community > Interests > Tilted Technology


 
 
LinkBack Thread Tools
Old 06-03-2003, 03:48 AM   #1 (permalink)
Upright
 
Access Help

I working on a program that will take into account the time of day before determining the date. I know it will take an If, Then statement (I think), but all I can think of is

If [Time] between 12:00:00 AM and 05:00:00 PM then [Date] = Date()-1

Hopefully that will make sense somehow. That code does not work obviously, I just don't know what to do. Any help would be appreciated.
Kent Brockman is offline  
Old 06-03-2003, 07:46 AM   #2 (permalink)
Stop. Think. Question.
 
rubicon's Avatar
 
Location: Redondo Beach, CA
What are you trying to accomplish?

You can call the function

Date() - 1

and it will subtract one day from the current day. Likewise,

Date() - 30

is 30 days earlier than the current date.
__________________
How you do anything is how you do everything.
rubicon is offline  
Old 06-03-2003, 10:57 AM   #3 (permalink)
Upright
 
I do need the day to be one previous, but it depends on the time of day. If the entry is made between 12:00 AM and 5:00 PM, it needs to be the previous days date, if not the current day would be used.
Kent Brockman is offline  
Old 06-09-2003, 04:33 PM   #4 (permalink)
Stop. Think. Question.
 
rubicon's Avatar
 
Location: Redondo Beach, CA
Do you still need help on this?
__________________
How you do anything is how you do everything.
rubicon is offline  
Old 06-10-2003, 04:30 AM   #5 (permalink)
Upright
 
Yes, sorry about the delay
Kent Brockman is offline  
Old 06-10-2003, 04:51 AM   #6 (permalink)
Searching for the perfect brew!
 
Brewmaniac's Avatar
 
Quote:
Originally posted by rubicon
Hell - the absence of broadband.
You've got that right! I'm stuck in dial-up hell!
__________________
"That's a joke... I say, that's a joke, son"
Brewmaniac is offline  
Old 06-10-2003, 07:30 AM   #7 (permalink)
Stop. Think. Question.
 
rubicon's Avatar
 
Location: Redondo Beach, CA
Try this:

Private Sub DateSub()

' declare variables
Dim intHourCurrent As Integer
Dim blnHourValid As Boolean
Dim strYourDate As String

' fetch current hour
intHourCurrent = DatePart("h", Now)

' if hour is between 00:00 and 17:00 then set flag to true, else false
blnHourValid = IIf((intHourCurrent >= 0 And intHourCurrent <= 17), True, False)

' if flag is true, store the previous day's date, else the current date
strYourDate = IIf(blnHourValid, Date - 1, Date)

' display results
MsgBox ("blnHourValid = " & blnHourValid & ", strYourDate = " & strYourDate)

End Sub

EDIT: I used the current time on my PC clock which was 8:30 am. I didn't change the clock to test the FALSE condition.
__________________
How you do anything is how you do everything.

Last edited by rubicon; 06-10-2003 at 07:35 AM..
rubicon is offline  
 

Tags
access


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 09:11 PM.

Tilted Forum Project

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54