Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / November 2006

Tip: Looking for answers? Try searching our database.

Can't find function

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mel - 06 Nov 2006 19:19 GMT
I have a program that was converted from Access 2.0 to Access 2003.  I’m in
the home-stretch of getting this out the door but only have a few lingering
issues.  

There is one function in a module that can’t be found, only at run-time.  
There are other sections of the code that reference other functions within
the same module and work just fine.  When I compile the program, this error
does not occur.  It only happens when I make the selection from the menu list
in run-time.  I get the following error in a message box:

“The expression you entered has a function name that Microsoft Access can't
find.”

Then an Action Failed pop-up message box appears with 'Halt' as the only
option.

I removed the .bas file from the application and added it back in and get
the same problem.  Has anyone seen this before?

Thanks in advance for your help.
Van T. Dinh - 06 Nov 2006 20:45 GMT
Are you sure the action related to a VBA Function or Sub?

IIRC (it has been a long time since I used Access Macro), "Halt" seems to be
associated with Macro and in this case, you need to check the actions in the
Macro.  Note that a Macro action can call a VBA function ... but you need to
check and trace the Macro first ...

Signature

HTH
Van T. Dinh
MVP (Access)

>I have a program that was converted from Access 2.0 to Access 2003.  I'm in
> the home-stretch of getting this out the door but only have a few
[quoted text clipped - 20 lines]
>
> Thanks in advance for your help.
Klatuu - 06 Nov 2006 21:05 GMT
You code is running a macro. The macro being run is either calling a function
that does not exist or is not visible to the macro (a scoping problem).

> I have a program that was converted from Access 2.0 to Access 2003.  I’m in
> the home-stretch of getting this out the door but only have a few lingering
[quoted text clipped - 16 lines]
>
> Thanks in advance for your help.
Mel - 07 Nov 2006 01:49 GMT
Yes, it is running a macro.  The macro calls a function in a .bas file.  The
function is not declared as private and other functions within the same .bas
file get called successfully from the same macro.  This is why I am stumped
as to why this one function is not recognized with VB.

By the way, the legacy code that I converted from Access 2.0 to Access2003
has these same macros and function calls and work just fine.  

> You code is running a macro. The macro being run is either calling a function
> that does not exist or is not visible to the macro (a scoping problem).
[quoted text clipped - 19 lines]
> >
> > Thanks in advance for your help.
Van T. Dinh - 07 Nov 2006 11:46 GMT
I am not sure whether this will fix your problem but in the relevant Macro,
find the RunCode action and check the function name argument to make sure
you had the correct spelling of the function name.

Even if it shows the correct function name, highlight the whole argument and
delete it then hit the Delete key a few times and BackSpace key a few times
(just incase there are invisible characters).  After that, re-type the
function name including the parentheses even if no function argument is
required.

That's what happened when I was asked to fix an A2000 databases (upgraded
from Access 2) about 4 years ago.

Signature

HTH
Van T. Dinh
MVP (Access)

> Yes, it is running a macro.  The macro calls a function in a .bas file.
> The
[quoted text clipped - 40 lines]
>> >
>> > Thanks in advance for your help.
Mel - 07 Nov 2006 19:46 GMT
I did as you suggested, but it still does not work.

I also went to the bottom of the screen where you can see the actual
Function Name and browsed out to the Expression Builder.  When I open the
Functions folder, the subsequent class modules and finally the list of
functions available to me, I can see the function in question.  Even when I
select the function through this list and try again, VB can not find it in
run-time.

I’m not sure how to debug a macro and didn’t find any documentation on how
to do so, but I thought the problem was within VB.

I deleted the function from within VB, saved it, exited Access, opened the
.bas module again and pasted the function back into the code.  It still does
not work.

There are six total function calls within this macro, 3 of which call the
function in question.  The other three work just fine, but they call
different functions.  I guess my next step is to get rid of the code
completely and write completely new code.

Thanks for your help, I really appreciate it.

> I am not sure whether this will fix your problem but in the relevant Macro,
> find the RunCode action and check the function name argument to make sure
[quoted text clipped - 53 lines]
> >> >
> >> > Thanks in advance for your help.
Van T. Dinh - 07 Nov 2006 20:40 GMT
* Have you tried recompile / compact & repair?
* Have you tried the /Decompile switch?
* Try also creating a new blank database and import all objects from the
exisitng database into the new blank database.
Signature

HTH
Van T. Dinh
MVP (Access)

>I did as you suggested, but it still does not work.
>
[quoted text clipped - 87 lines]
>> >> >
>> >> > Thanks in advance for your help.
Mel - 08 Nov 2006 22:29 GMT
The problem is fixed and I feel like such an idiot.  

The reason it didn't work was because a module and function had the same
name.  The function was in a different module.  In this case, I had a module
called "Deluxe" and a function in a different module also called "Deluxe".

So in Access 2.0, the same name could be share across functions and modules
but it is not the case in Access 2003.  The compiler caught this problem with
different app, but I think in that case the function and the module were
contained in the same unit.

Thank you so much for your help.

> * Have you tried recompile / compact & repair?
> * Have you tried the /Decompile switch?
[quoted text clipped - 91 lines]
> >> >> >
> >> >> > Thanks in advance for your help.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.