Avatar of tyrfing
tyrfing asked on

Undefined Function in Access 2007

I am trying to convert strings in Access to Proper Case.  I'm calling the function I created "ProperCase" in a query and I continually get the "undefined function" error.  I have clicked on the Tools References and don't find any "missing" references at all.  I can't compile the code because the "compile" line is dimmed.  The code has worked in previous versions of access, so I figured I'm just not calling it up right.  The code is entered as a module and named "Propercase".  I am simply calling it in an update query as Propercase([FirstName]), when I get the error.

Any help would be appreciated.
Option Explicit           ' Require variables to be declared before being used.
Option Compare Database   ' Use database order for string comparisons.
Function ProperCase(strToChange As String) As String
    ' Converts string to Proper case
    On Error Resume Next
    ProperCase = StrConv(strToChange, vbProperCase)
End Function

Open in new window

Microsoft Access

Avatar of undefined
Last Comment
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

8/22/2022 - Mon
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

Is your ACCDB in a Trusted Location ?


Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Renaming worked.
Why?  I realize you're under no obligation to post an answer, I'm just curious for future reference.

DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

The 'why' is that they simply cannot be the same. Access gets confused trying to distinguish between the two of them.

Your help has saved me hundreds of hours of internet surfing.

Yeah, probably some internal naming searching restriction, it stops at the first object with that name and probably the module is in front of the function in that list.
Maybe this is documented somewhere but it's really not that interesting to search unles is really needed.
Luke Chung

I think it looks at the module name as part of the procedure name.  For instance, you can call a procedure explictly by Modulename.ProcName, so it probably gets confused when it sees just the module name with nothing after it.  My guess based on the work we've done parsing VB6 and VBA code.
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

Yeah ... Luke.Luke() ... pretty weird, lol.

Hey ... thanks for that table on the Error #'s.  I will be in touch with you more about that ...

Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.