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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

eDate Function in Access 1

Status
Not open for further replies.

droolg

Instructor
Apr 6, 2004
2
US
I'm sure what I want is pretty basic, but I just can't seem to find the answer in any posts or any of my "mastering" books.
I just want to use the eDate function In Access 2000. Which, like "Workday" will show up in Excel if I add-in the Analysis toolpak. Although I've seen it used in several threads here, I just can't get it to work.
In a query (design view, I'm not too good at SQL) I've tried using it with Where and Expression but it keeps asking me to "define eDAte". Which leads me to believe it's not in any of the libraries in Access but probably has to be created in a global module [manually].
If anyone could post the code or tell me where to find it, it would be much appreciated.

What I'm trying to is find out the Monthly Payment dates from the date of a loan. That is, From the field "dtDateOfLoan" which may be Dec 31, 03.
I'd like "curPayment1" to be Jan 31, 04
curPayment2 should equal Feb 29, 04
curPayment3 = Mar 31,04
curPayment4 = Apr 30, 04
Etc.

Many thanks in advance.
==========================

Qman

"You know you enjoy code,
when you dream in it.
 
Here is a custom eDate function that I believe is what you want

Code:
Function eDate(dtDateOfLoan As Date, intPaymentNumber As Integer) As Date

    eDate = DateAdd("m", intPaymentNumber, dtDateOfLoan)

End Function
 
mddrlion: Thank you very very much for the quick response. This looks like the right answer.

In the QBD grid, I've typed in the field heading:
Payment2:edate([dtDateOfLoan],2)
(where dtDateOfLoan was already a field in the grid)

And it worked perfectly!
11/25/03 became 1/25/04
12/31/03 became 2/29/04

Marvelous! Reading your code made it seem so simple.

Now if there was a simple answer like that for the "Workdate" function.

Thanks Again!

==================================
"It never rains in the Infantry,
it always rains ON the Infantry!"
==================================
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top