S
Sreedhar
My regional settings for Short Date is "dd/mm/yyyy". I wrote a function to
determine number of months between two dates based on the article at:
http://www.mvps.org/access/datetime/date0005.htm
but a "Type Mismatch" error occurs with this code:
Global Const JetDateTimeFmt = "\#mm\/dd\/yyyy hh\:nn\:ss\#;;;\N\u\l\l"
Global Const JetDateFmt = "\#mm\/dd\/yyyy\#;;;\N\u\l\l"
Global Const JetTimeFmt = "\#hh\:nn\:ss\#;;;\N\u\l\l"
Function NumMonths(dtDate As Variant) As Long
Dim StartDate As Variant
Dim EndDate As Variant
StartDate = Format(dtDate, JetDateFmt)
EndDate = Date
NumMonths = DateDiff("m", StartDate, EndDate)
End Function
Can someone tell me what's wrong with this ?
Also, I didn't quite understand those ";;;\N\u\l\l" in the formatting.
Please tell me what they are.
determine number of months between two dates based on the article at:
http://www.mvps.org/access/datetime/date0005.htm
but a "Type Mismatch" error occurs with this code:
Global Const JetDateTimeFmt = "\#mm\/dd\/yyyy hh\:nn\:ss\#;;;\N\u\l\l"
Global Const JetDateFmt = "\#mm\/dd\/yyyy\#;;;\N\u\l\l"
Global Const JetTimeFmt = "\#hh\:nn\:ss\#;;;\N\u\l\l"
Function NumMonths(dtDate As Variant) As Long
Dim StartDate As Variant
Dim EndDate As Variant
StartDate = Format(dtDate, JetDateFmt)
EndDate = Date
NumMonths = DateDiff("m", StartDate, EndDate)
End Function
Can someone tell me what's wrong with this ?
Also, I didn't quite understand those ";;;\N\u\l\l" in the formatting.
Please tell me what they are.