473,387 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

User-Defined Functions in SELECT Statements

Access 97

I have a number of SELECT statements which contain references to
user-defined VBA functions. These typically work as expected, but
occasionally, on one user's machine or another, produce a "function not
defined" message when the SELECT statement is executed, even having
previously worked on that machine.

What can I do to correct this difficulty when it occurs? What do I need
to know about user-defined functions in SELECT statements?

TIA,
-Dave

--
"Sometimes what seems to be enough smoke to guarantee a robust
fire is actually just a cloud of dust from a passing bandwagon."
- Daniel Dennett
Nov 12 '05 #1
2 5464
Hi, Dave.

Pretty frustrating, huh? Sometimes Jet can find that user-defined function
and sometimes it just can't, even though you've defined it publicly in a
module. The reason it fails is that your user-defined function is not
already loaded into memory when the query runs, and Jet 3.5 isn't going to
go hunt for it beyond the libraries contained in the References Collection.

When you call a procedure that is defined in a module, all of the procedures
in that module are loaded into memory, not just that single procedure. On
the occasions that you didn't get the "Function not defined" error message
when you ran the query, your user-defined function was already loaded into
memory, due to the coincidence that some other procedure in that same module
had already been called.

To prevent this from happening in the future, remove the "coincidence"
factor before you run your query by explicitly calling one of the procedures
in the same module where the user-defined function is stored. You can even
create a "dummy" procedure in this same module that does nothing, except
have its name called just before the query runs so that all procedures in
that module are loaded into memory beforehand.

I suppose that you could also place these user-defined functions in a
library MDE file and reference the library, but that may be overkill for
your application.

HTH.
Gunny

Coming soon:
For your Microsoft Access, database development and maintenance needs, see:
http://www.softomagixly.com
"David Emme" <demme@ZERO_SPAMpobox.com> wrote in message
news:c2**********@216.39.176.203...
Access 97

I have a number of SELECT statements which contain references to
user-defined VBA functions. These typically work as expected, but
occasionally, on one user's machine or another, produce a "function not
defined" message when the SELECT statement is executed, even having
previously worked on that machine.

What can I do to correct this difficulty when it occurs? What do I need
to know about user-defined functions in SELECT statements?

TIA,
-Dave

--
"Sometimes what seems to be enough smoke to guarantee a robust
fire is actually just a cloud of dust from a passing bandwagon."
- Daniel Dennett

Nov 12 '05 #2
Also go to Tools->Options on the flip Module. Read the help text for the
check box: Compile on demand. I am not sure I understand it fully, but I
think the best thing is to have this box unchecked.

Brdgds
Rolfern

"'69 Camaro" <Ze*******@ZeroSpam.com> wrote in message
news:c2********@library1.airnews.net...
Hi, Dave.

Pretty frustrating, huh? Sometimes Jet can find that user-defined function and sometimes it just can't, even though you've defined it publicly in a
module. The reason it fails is that your user-defined function is not
already loaded into memory when the query runs, and Jet 3.5 isn't going to
go hunt for it beyond the libraries contained in the References Collection.
When you call a procedure that is defined in a module, all of the procedures in that module are loaded into memory, not just that single procedure. On
the occasions that you didn't get the "Function not defined" error message
when you ran the query, your user-defined function was already loaded into
memory, due to the coincidence that some other procedure in that same module had already been called.

To prevent this from happening in the future, remove the "coincidence"
factor before you run your query by explicitly calling one of the procedures in the same module where the user-defined function is stored. You can even create a "dummy" procedure in this same module that does nothing, except
have its name called just before the query runs so that all procedures in
that module are loaded into memory beforehand.

I suppose that you could also place these user-defined functions in a
library MDE file and reference the library, but that may be overkill for
your application.

HTH.
Gunny

Coming soon:
For your Microsoft Access, database development and maintenance needs, see: http://www.softomagixly.com
"David Emme" <demme@ZERO_SPAMpobox.com> wrote in message
news:c2**********@216.39.176.203...
Access 97

I have a number of SELECT statements which contain references to
user-defined VBA functions. These typically work as expected, but
occasionally, on one user's machine or another, produce a "function not
defined" message when the SELECT statement is executed, even having
previously worked on that machine.

What can I do to correct this difficulty when it occurs? What do I need
to know about user-defined functions in SELECT statements?

TIA,
-Dave

--
"Sometimes what seems to be enough smoke to guarantee a robust
fire is actually just a cloud of dust from a passing bandwagon."
- Daniel Dennett


Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

60
by: Fotios | last post by:
Hi guys, I have put together a flexible client-side user agent detector (written in js). I thought that some of you may find it useful. Code is here: http://fotios.cc/software/ua_detect.htm ...
3
by: zlst | last post by:
Many technological innovations rely upon User Interface Design to elevate their technical complexity to a usable product. Technology alone may not win user acceptance and subsequent marketability....
2
by: Jesper Stocholm | last post by:
I have implemented role-based security within my ASP.Net application. However, it seems the role is not passed to the authentication ticket I create. I want to use it to display/hide some...
6
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header"...
1
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a...
0
by: tony | last post by:
Hello! This is a rather long mail but it's a very interesting one. I hope you read it. I have tried several times to get an answer to this mail but I have not get any answer saying something...
2
by: rn5a | last post by:
Assume that a user control (MyUC.ascx) encapsulates 2 TextBoxes with the IDs 'txt1' & 'txt2' respectively. To use this user control in an ASPX page, the following Register directive will be...
1
by: Carlettus | last post by:
Dear All, sorry but I'm not sure if this is the right place to post my problem. I was using the following asp code to create users in Active Directory. Suddenly, and I don't know the reason, users...
9
by: Gordon | last post by:
I want to add a feature to a project I'm working on where i have multiple users set up on my Postgres database with varying levels of access. At the bare minimum there will be a login user who...
3
by: shapper | last post by:
Hello, On my web site I have a property, Visitor, which is available for Anonymous users: public class Visitor { public CultureInfo Culture { get; set; } public List<GuidPolls { get; set;...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.