Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax to Include Module Path to Run a Query

Status
Not open for further replies.

GGleason

Technical User
Mar 22, 2001
321
US
I have the following query that works:

SELECT tblCATAx.*, YesLwrCs([SDTE]) AS YLC
FROM tblCATAx
WHERE (((YesLwrCs([SDTE]))=False))
ORDER BY tblCATAx.GTYP, tblCATAx.CATE, tblCATAx.SDTE;

This MDB has a public function called YesLwrCs that is a boolean funtion to determine if a string passed to it has any lower case characters and passes a True value if it finds any lower case characters.

When I try calling this query from another MDB, I get an "Undefined Function" error. If I copy the function to the MDB where the query had the error, the error goes away and the query runs. But for maintenance reasons, I would like the query to be stand alone without copying modules hither and yon.

Does anyone know the syntax to include the path to make this query run?

Thank you in advance for your time and response.
 
You need to add the 'foregin' db to the references of the db where you need to instantiate the function. Look it up in the help system. You can only do this in a code module for ver 2K.

MichaelRed
mred@att.net

There is never time to do it right but there is always time to do it over
 
MichaelRed,

First of all, I am grateful for your response. Thank you. By ver 2K, do you mean Access 2000? I am using Access 97 SR-2. I looked up foreign in Help and was at a loss as to what I was looking for. Do I need to pass an argument to the function that specifies the path and/or mdb name?

The function is found below:

Public Function YesLwrCs(strVal As String) As Boolean
Dim strChar As String
YesLwrCs = False
For i% = 1 To Len(strVal)
strChar = Mid(strVal, i%, 1)
If Asc(strChar) >= 97 And Asc(strChar) <= 122 Then
YesLwrCs = True
Exit For
End If
Next i%
End Function

 
The reference to ver 2K does mean the version of access. It only is important in the location of the references dialog box. You STILL need to find 'References&quot; on a menu for ver '97, I'm just not certain where you will find it as I have not had a ver. '97 installed for over a year. I THINK you still need to be in a public? module then look under tools. If you are looking in help, try REFERENCES.

MichaelRed
mred@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top