Function edate

  • Thread starter Thread starter Guest
  • Start date Start date
EDate is an Excel function, not an Access one. This doesn't mean that you
can't use it, but you'd have to go through Excel to use it, which can be
inefficient.

See http://support.microsoft.com/kb/198571 for details. (Don't worry that it
only lists Access 2000: it applies to Access 2003 as well)

You might want to see whether you can program the same functionality in
Access, though.
 
How could I use the function edate in Access 2003?

As Douglas says... not very easily.

Could you explain what data you're working with and what you are trying to
accomplish, in real-life terms? There may well be a pure Access/VBA solution
which does not need EDate.

John W. Vinson [MVP]
 
Alia said:
How could I use the function edate in Access 2003?

Maybe:

'---Begin Module Code---
Public Function EDate(dtStart As Date, lngMonths As Long) As String
Dim dtTemp As Date
Dim lngDays As Long

dtTemp = DateAdd("m", lngMonths, dtStart)
lngDays = DateDiff("d", DateSerial(1899, 12, 30), dtTemp)
EDate = "equals " & CStr(lngDays) & " or " & Format(dtTemp, "mm/dd/yy")
End Function
'---End Module Code---

Examples:

MsgBox(EDate(#01/15/91#, 1) => 'equals 33284 or 02/15/91'
MsgBox(EDate(#03/31/91#, -1) => 'equals 33297 or 02/28/91'
MsgBox (EDate(#3/29/2007#, -1)) => 'equals 39141 or 02/28/07'

Note that this function does not use Int(dtTemp).

James A. Fortune
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top