fnMonday(Date()) works in one database file, but not the other

W

wessman

I have an older Access database file that has been converted from an
older version of Office to XP/2002 format. That existing database
using the fnMonday(Date()) expression in almost every query.

My problem...

I created a new database after getting Office XP and that same
fnMonday(Date()) expression throws an error everytime I use it in a
query in this new database. And come to think of it, in my Excel XP,
if I try to import a query from any database and that query has this
fnMonday expression, Excel throws a similiar error about an invalid
expression.

Any thoughts?
 
D

Douglas J. Steele

fnMonday is not a built-in function in Access, so it must be something you
included in your original database.

Did you include the code associated with that function in your new database?

If you did, and you're still getting errors, repost with the code for
fnMonday, and the exact error message you're getting.
 
A

Albert D. Kallal

Hum, since you are using date, perhaps you have a broken ref.

You need to add the

Micosoft DAO 3.6 Object Libary

To you referances.

Check out:

Allen Browne
http://users.bigpond.net.au/abrowne1/ser-38.html

Doug Steele:
http://members.rogers.com/douglas.j.steele/AccessReferenceErrors.html

Peter Walker:
http://www.papwalker.com/dllhell/index-page2.html


MsKb Articles: 310803, 208218, 209849, 286300

ACC2000: How Access 2000 Resolves Visual Basic for Applications References
http://support.microsoft.com/default.aspx?scid=kb;en-us;248941

ACC2000: How to Resolve Reference Issues in an Access Database
http://support.microsoft.com/default.aspx?scid=kb;en-us;310803
 
W

wessman

Doug was right. I just never realized the older database had a module
full of functions. Here's what I was looking for:

Function fnMonday(dtInput As Date) As Date
On Error GoTo fnMonday_Err

Dim intDay As Integer, dblDay As Double

intDay = WeekDay(dtInput, vbMonday)
dblDay = -(intDay - 1)
fnMonday = DateAdd("d", dblDay, dtInput)

fnMonday_Exit:
Exit Function

fnMonday_Err:
MsgBox Error$
Resume fnMonday_Exit

End Function
 

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

Top