PDA

View Full Version : undefined function


nicky
09-27-02, 11:29
Hi All,

I am having trouble retreiving data from a acces database with IIS.

Here's the story:

I've set up a acces database with 3 tables, some query's and one VBAfunction.

One of those query's is using the VBAfuntion. While in access executing the query it is returning the records just fine. If I try to execute the query trough IIS I get some "undefined funtion" error message.
(I'm running a dutch IIS version and the exact error
"Microsoft JET Database Engine error '80040e14'
De expressie bevat een ongedefinieerde functie StringToUrl.
/advertentie.asp, line 31" also dutch.)
The query's not using the VBAfunction behave as expected.

I have searched the internet for some time now, and I cannot find a related topic.

For the record: I'm Dutch and I hope my english is not too confusing.

rnealejr
09-27-02, 13:26
Can you translate the error message description to english ?

rnealejr
09-27-02, 13:34
Which version of vb/access are you running ?

nicky
10-04-02, 09:44
Hi, sorry it took a while to respond.

The error message:
"De expressie bevat een ongedefinieerde functie StringToUrl",
would translate as:
"The expression contains a undefined function StringToUrl",
where StringToUrl is the previously mentioned VBAFunction.

I am using Access 2000 (9.0.3821 SR-1) and IIS 5.0.

rnealejr
10-04-02, 13:47
How are you accessing the data from access (ado/dao) ? Are you using vbscript or javascript ?

rnealejr
10-04-02, 13:49
Also, how are you using the StringToUrl function ? Can you post the code ?

nicky
10-09-02, 04:04
Here's a snippet from the ASP

<%
Dim Conn, RS
Dim strId,strSQL,intLoop

strId=Request.QueryString("id")
strSQL = "SELECT * FROM qryAdv Where IdAdvertentie=" & strId

Set Conn=Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("\") & "\db\allestekoop.mdb"
Set RS=Server.CreateObject("ADODB.RecordSet")
RS.Open strSQL, Conn, adOpenDynamic, adLockPessimistic, adCMDText

This is the Query

SELECT tblAdv.IdAdvertentie, tblAdv.IdCatagorie, tblAdv.Datum, tblCat.Catagorie, tblAdv.Teller, IIf([AangebodenGezocht],"Gezocht","Aangeboden") AS AangebodenOfGezocht, tblAdv.Naam, tblAdv.Woonplaats, tblProv.Provincie, "<a href=mailto:" & [tblAdv].[Email] & ">" & [tblAdv].[Email] & "</a>" AS [E-mail], tblAdv.Telefoon, tblAdv.Prijs, tblAdv.Omschrijving, IIf(IsNull([tblPic]![Pic]),'Nee','<a href=' & StringToUrl('ToonFoto.asp?Omsch=' & [tblAdv]![Omschrijving] & '&IdAdv=' & [tblPic]![IdAdvertentie]) & '>Klik hier</a>') AS Foto, tblAdv.Beschrijving
FROM ((tblAdv INNER JOIN tblCat ON tblAdv.IdCatagorie = tblCat.IdCatagorie) INNER JOIN tblProv ON tblAdv.IdProv = tblProv.IdProv) LEFT JOIN tblPic ON tblAdv.IdAdvertentie = tblPic.IdAdvertentie;

This is the Function

Public Function StringToUrl(strInput As String) As String

Dim intLoop As Integer
Dim strChar As String * 1
Dim strOutput

For intLoop = 1 To Len(strInput)
strChar = Mid$(strInput, intLoop, 1)
Select Case strChar
Case " "
strOutput = strOutput + "%20"
Case Else
strOutput = strOutput & strChar
End Select
Next
StringToUrl = "'" & strOutput & "'"

End Function