Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing Dates 1

Status
Not open for further replies.

davidmulcair

Programmer
Jun 26, 2001
35
CA
Im having troubles:

I want to see if LoanDueDate is more than eight months in advance of LoanIssueDate. How would I do that?

I tried using DateDiff, but it's format is confusing me...

On a similar vein, how would I check for a date in the past???

Access is frustrating with dates..

David Mulcair
 
Let me clear "date diff" up for you
I break things out in "baby steps"

Dim Date1, Date2 As Date
Date1 = "03/04/01"
Date2 = Format(Now, "mm/dd/yy") 'todays date

Number_of_Months_Between = DateDiff("m", Date1, Date2)
If Number_of_Months_Between = 8 Then
'we are 8 months out
MsgBox "We are Eight Months out"
Else
' we are not
MsgBox "We are NOT Eight Months out"
End If

here is a list of the options for the "m"

DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
yyyy Year
q Quarter
m Month
y Day of year
d Day
w Weekday
ww Week
h Hour
n Minute
s Second
DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
I'm not sure if your trying to accomplish what you are doing in a query or in code. my assumption is using a query. This is based on a table that Contains two fields:
Res = Result field from the query, res1, res2, res3,

Date1 Date2 res1 res2 res3
01/01/2001 08/15/2001 226 7 32


Res1: [Date2]-[Date1] 'number days

Res2: Month([Date2])-Month([Date1]) 'number of mths

Res3: DateDiff("ww",[date1],[date2]) 'number of weeks

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top