Link to home
Start Free TrialLog in
Avatar of 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

Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Is your ACCDB in a Trusted Location ?

Avatar of madgino
Flag of Romania image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tyrfing


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

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

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.
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.
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 ...