public function - not recognized within query statement

  • Thread starter Thread starter Wayne Fry
  • Start date Start date
W

Wayne Fry

I have declared a global variable inside a module for the purpose of
referencing the value of that variable in a number of queries. I have
also created a public wrapper function in the same module to allow
access to the variable. Here's an example:

global myGlobal as string

public function get_myGlobalValue()
get_myGlobalValue = myGlobal
end function

My issue is that I am encountering an error when I build and run the
following query in query designer.

SELECT myTable.*
FROM myTable
WHERE (somecolumn = get_myGlobalValue())

The error is "ADO Error. get_myGlobalValue is not a recognized
function name."

It seems to me I either have a scoping issue or incorrect syntax. Any
thoughts on how to clear the problem?

Thanks, Wayne

Access 2002 running against SQL server 7.0
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

My guess: You have an .adp file.

You cannot use a VBA function in an SQL Server query, which is what
queries are in .adp files. Because the server has no way to reference
the VBA function that resides in the db's front-end (the interface that
should be on your PC).

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQSTzuYechKqOuFEgEQKcLACfRWF0FtbSoXNlMsQ0+dnUMaNLpnQAn3v6
k2cmY9Ui5FOc1iQNnTurf+QL
=Gl+5
-----END PGP SIGNATURE-----
 
Back
Top