Wow, I’m having a hard time trying to figure this out,
I have a function that lets the user know when the next anniversary date of a given date will be, this function works fine using Access 97 under Windows 98, Windows 2000, but under Windows XP running Access 97, I receive undefined function ‘Next Anni’ in expression when you run the query that contains this function. If I go to the immediate window pane and run the same function, it will work properly. Has anyone run into this problem before if so how did you get around this problem?
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Undefined Function (Access 2000 and 97)
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Undefined Function (Access 2000 and 97)
- This topic has 26 replies, 9 voices, and was last updated 22 years, 5 months ago.
AuthorTopicWSunpuertomex
AskWoody LoungerDecember 20, 2002 at 12:17 am #380958Viewing 3 reply threadsAuthorReplies-
WSMarkLiquorman
AskWoody LoungerDecember 20, 2002 at 1:17 pm #640073Apparently, there is something about the expression in the query that Access doesn’t like, perhaps somehow something got into it during conversion. It sounds simplistic, but sometimes just deleting the expression and typing it in again may help. Also, try using that function in another query, just to see if Access likes it there.
-
WScharlotte
AskWoody Lounger -
WSunpuertomex
AskWoody LoungerDecember 20, 2002 at 10:42 pm #640177Ok, this is the function I’m using, its pretty streight foward.
Function NextAnni(dtmDate As Date) As Date
‘ Find the next anniversary of a date.
‘ dtmDate:
‘ A date representing anniversary.
‘ Return Value:
‘ The next occurence of the specified date. If the date hasn’t
‘ occurred yet this year, return the date within the
‘ current year. Otherwise, return the date in the next
‘ year.Dim dtmThisYear As Date
‘ What’s the corresponding date in the current year?
dtmThisYear = DateSerial(Year(Now), Month(dtmDate), Day(dtmDate))‘ If the anniversary has already occurred, then add 1 to the year.
If dtmThisYear < Date Then
dtmThisYear = DateAdd("yyyy", 1, dtmThisYear)
End If
NextAnni = dtmThisYear
End Function -
WSMarkD
AskWoody LoungerDecember 21, 2002 at 8:55 am #640213There’s nothing wrong with the function itself. The “Undefined Function” error when trying to open query results from missing references, as Tom Weller noted in his reply. See this MSKB article, it refers to Access 2002 but the information re undefined function error message is equally applicable for other versions of Access:
Recommend check for missing references in your project.
HTH
-
WSunpuertomex
AskWoody Lounger -
WSMarkD
AskWoody LoungerDecember 22, 2002 at 12:08 pm #640292If the computer on which program is running is missing any of the project’s referenced type library files as listed in References, then the error will occur, even if query works OK on your computer. AFAIK all the VBA date functions (DateAdd, etc) used by the custom function were valid in A97. I no longer use Access 97 so have no way of testing whether running A97 under WIN XP is cause of problem; maybe someone with this configuration can determine if this is a factor or not.
-
WScarbonnb
AskWoody Lounger -
WSunpuertomex
AskWoody LoungerDecember 24, 2002 at 12:45 am #640579Sorry for the delay in posting, been spending late hours at work. Ok, I’ve attached a copy of the application when you start up the app it will come to a main form choose Find Anniversary, before the form opens you should get the error, the query its running is titled qryfindcontacts. If any one find out anything please let me know. Thank!
-
WSMarkD
AskWoody LoungerDecember 24, 2002 at 9:29 am #640623To open files, I had to convert them to A2K format (running AXP) & got conversion errors – the Reminder_be.mdb file conversion error reads “Missing or broken VBE reference to the file ‘dao2535.tlb’ – see attd error msg (this is reference to MS DAO 2.5/3.5 Compatability Library). I have only AXP installed on this computer. The references in front end Reminder.mdb seemed OK. I did not get error when opening frmListOfAnv form or qryFindContacts query. The NextAnni function worked OK. As for the query, this has to be the most convoluted query I’ve ever seen. I’m surprised it works at all, “undefined function” error or not. Its based on two other queries, and its length is 14579 characters, nearly 1/4 of the maximum of “approximately 64,000” for “Number of characters in an SQL statement” as stated in Access query limitations. There’s also a limitation of 99 “AND”s in a WHERE or HAVING clause but who’s counting….
I’d recommend getting rid of any “Compatability” or “Extensibilty” references in both front end & back end & try to somehow simplify the overly convoluted query.
HTH
-
WScharlotte
AskWoody LoungerDecember 22, 2002 at 4:42 pm #640315We run A97 under WinXP on some of the machines at work without any problems. There has to be a reference in the application that doesn’t exist on the XP machine. Are you trying to send email from the application by any chance, or referencing the CDO/MAPI library? That doesn’t get installed on a WinXP machine unless you install Outlook with some custom settings.
-
WSunpuertomex
AskWoody LoungerDecember 24, 2002 at 12:53 am #640586Hello Charlotte,
Thanks for your response, I double checked my references and there is no sign of anything missing, each check mark is referencing an actual item, the app is actualy a very simple program, nothing out of the norm. I attached a copy of the app on earlier post, your welcome to dowload it and see if you have the same problem as user is having. I would love to get this resolved.
Thanks! -
WScharlotte
AskWoody LoungerDecember 24, 2002 at 4:06 am #640601Lose the Extensibility Library reference. I didn’t get a compile error when I unchecked it, but it will cause you problems if that file isn’t available on the machine. There are other extensibility libraries and on my machine both of them are for VB/VBA 6 rather than the VB/VBA 5 version you had checked. It doesn’t come up as missing, on my PC, but I wouldn’t expect to find it on a machine that had never had Office 97 or VB5 installed.
-
WSunpuertomex
AskWoody LoungerDecember 27, 2002 at 2:06 am #640862Well, I did a netmeeting with the person who is having the problem, and they didn’t have Extensibility Library reference checked, there was only 3 items checked Visual Basic For Applications, Microsoft Access 8.0 Object Library, and Microsoft DAO 3.51 Object Library, if I uncheck Microsoft DAO 3.51 Object Library I don’t get the error however the form still doesn’t work. So as a last resort I asked the user to un-stall and re-install and that fixed the problem, it seem that it was a bad installation. Wow, this one was driving me mad.
One last thing, Mark D. how would you simplify the overly convoluted query??
Well Thank everyone!! for your help I sure learned a few thing.
-
WSpatt
AskWoody Lounger
-
-
-
-
-
WStaweller
AskWoody Lounger -
WSunpuertomex
AskWoody Lounger
-
-
WSJayden
AskWoody LoungerDecember 27, 2002 at 8:04 am #640880Hi
If there was a missing reference, I would expect the behaviour to be the same from the immediate window also, but the function runs fine when run from the immediate window?
A guy i work with had a problem the other day, similar to this, but nothing to do with missing references. When trying to use the ‘replace’ function from a query in Acc 2000, he got the same error message, although, when using it from VBA there was no problem. The only solution was to wrap the replace function inside a custom function and call the custom function! it appears that some in-built functions in Acc do not work directly from queries.
Although this is not exactly the same situation as you, it sounds a little bit similar, but you are calling a custom function from a query.
I don’t know how much help this is, but it might ‘jog’ someone elses memory about this problem?
Cheers
-
WScharlotte
AskWoody LoungerDecember 27, 2002 at 12:42 pm #640895Some queries can become so complex that they will run as a query from the user interface but not as the source for a report. Reports generate temporary queries when they are opened, so if a query is just on the edge of too complex, using it as a report recordsource will tip it over.
Depending on how a function is called from a query, it may run over and over again, and some functions aren’t really appropriate to calling in queries. I would put Replace in that category because of the nature of what it does. If the query affected a small number of records, no problem. If it affected a large number of records, unusable.
-
WSMarkD
AskWoody LoungerDecember 27, 2002 at 1:21 pm #640900Some funtions introduced in VB/VBA 6.0 do not always “function” correctly if you try to use them in a query expression in Access 2K. It may be because the A2K query engine wasn’t updated to recognize these new functions?? In the case of the Replace function, according to the Access 2000 Readme file (Acread9.txt):
[indent]
Functions Broken Because Of vbDatabaseCompare
———————————————
The InStrRev, Split, Filter, and Replace functions may fail because of errors resulting from the use of vbDatabaseCompare. The workaround is to explicitly specify a comparison argument, for example, vbBinaryCompare or vbTextCompare.
[/indent]
(Note – all of above were introduced in VB/VBA 6.0.) If using one of these functions in query expression, you cannot use named constant for optional Compare argument, you have to use actual value. These are:Const vbBinaryCompare = 0
Const vbTextCompare = 1
Const vbDatabaseCompare = 2The default for all 4 functions is vbBinaryCompare (case-sensitive comparison). vbTextCompare indicates case-insensitive comparison. You can try to use function in query, explicitly specifying numerical value for Compare argument, and see if it works. I do not have A2K installed on my PC so I cannot test this; these functions work correctly when used in query expressions in AXP. Otherwise, as noted, wrap function in a user-defined function which can then be used in a query.
HTH
-
WScharlotte
AskWoody Lounger -
WSunpuertomex
AskWoody LoungerJanuary 1, 2003 at 12:30 am #641581Just when I thought I had this problem fixed, the user goes out and re-boot his PC and it starts all over again. As it turns out un-instaling and re-install only keeks the program running correctly as long as you don’t re-boot after re-booting the problem start all over again!
Is there no end to this madness?? -
WScharlotte
AskWoody LoungerJanuary 1, 2003 at 2:43 am #641594Excuse me, but that doesn’t make any sense. Rebooting the machine shouldn’t change the libraries that are on it unless some of his references are on network drives or removeable drives which are not always available. If that is the case, all bets are off because Access isn’t really designed to be run that way. Is there something about that installation you haven’t told us? Is Access running on Transaction Server or some kind of virtual machine rather than local to his workstation?
-
WSunpuertomex
AskWoody LoungerJanuary 2, 2003 at 12:11 am #641677Sorry Charlotte, but these are the facts, the user is using Windows XP Home Edition with MS Office 97 in their home and it isn’t on a network. The installation was a standard one, I’ve even checked and made sure that all of the service packs were install. I guess my next step is to make a post in the Win XP forum to see if this happens to be a windows admin issue or what have you.
Do you have any recomendations? -
WBell
AskWoody_MVPJanuary 2, 2003 at 2:20 am #641693Have you checked to see what service packs have been applied to Office? There were some insidious problems with Access 97 running on Windows 2000 PCs that were solved with service packs for both Office and Windows. It’s sort of a shot in the dark, but at this point it sounds like you are sort of stumped.
-
WSunpuertomex
AskWoody Lounger -
WSunpuertomex
AskWoody Lounger
-
-
-
-
Viewing 3 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Rufus is available from the MSFT Store
by
PL1
24 minutes ago -
Microsoft : Ending USB-C® Port Confusion
by
Alex5723
2 hours, 33 minutes ago -
KB5061768 update for Intel vPro processor
by
drmark
15 minutes ago -
Outlook 365 classic has exhausted all shared resources
by
drmark
44 minutes ago -
My Simple Word 2010 Macro Is Not Working
by
mbennett555
17 hours, 45 minutes ago -
Office gets current release
by
Susan Bradley
56 minutes ago -
FBI: Still Using One of These Old Routers? It’s Vulnerable to Hackers
by
Alex5723
1 day, 15 hours ago -
Windows AI Local Only no NPU required!
by
RetiredGeek
23 hours, 31 minutes ago -
Stop the OneDrive defaults
by
CWBillow
1 day, 15 hours ago -
Windows 11 Insider Preview build 27868 released to Canary
by
joep517
2 days, 1 hour ago -
X Suspends Encrypted DMs
by
Alex5723
2 days, 3 hours ago -
WSJ : My Robot and Me AI generated movie
by
Alex5723
2 days, 4 hours ago -
Botnet hacks 9,000+ ASUS routers to add persistent SSH backdoor
by
Alex5723
2 days, 4 hours ago -
OpenAI model sabotages shutdown code
by
Cybertooth
2 days, 5 hours ago -
Backup and access old e-mails after company e-mail address is terminated
by
M W Leijendekker
1 day, 17 hours ago -
Enabling Secureboot
by
ITguy
2 days ago -
Windows hosting exposes additional bugs
by
Susan Bradley
2 days, 13 hours ago -
No more rounded corners??
by
CWBillow
2 days, 9 hours ago -
Android 15 and IPV6
by
Win7and10
1 day, 22 hours ago -
KB5058405 might fail to install with recovery error 0xc0000098 in ACPI.sys
by
Susan Bradley
3 days, 1 hour ago -
T-Mobile’s T-Life App has a “Screen Recording Tool” Turned on
by
Alex5723
3 days, 4 hours ago -
Windows 11 Insider Preview Build 26100.4202 (24H2) released to Release Preview
by
joep517
2 days, 23 hours ago -
Windows Update orchestration platform to update all software
by
Alex5723
3 days, 11 hours ago -
May preview updates
by
Susan Bradley
2 days, 23 hours ago -
Microsoft releases KB5061977 Windows 11 24H2, Server 2025 emergency out of band
by
Alex5723
2 days, 14 hours ago -
Just got this pop-up page while browsing
by
Alex5723
3 days, 3 hours ago -
KB5058379 / KB 5061768 Failures
by
crown
3 days, 1 hour ago -
Windows 10 23H2 Good to Update to ?
by
jkitc
2 days, 3 hours ago -
At last – installation of 24H2
by
Botswana12
4 days, 3 hours ago -
MS-DEFCON 4: As good as it gets
by
Susan Bradley
1 hour, 12 minutes ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.