HELP, I need Somebody, HELP :)) - SQL 
Author Message
 HELP, I need Somebody, HELP :)) - SQL

Hi there.

I usually find out how to solve my problems by my own. But I got no
time anymore to find that answer.

I got this SQL in my VB5 Application.

SELECT * FROM CLIENTS WHERE MY_FUNCTION_IN_VB( Field ) = TRUE.

Why is it not  working ?
It keeps answer me that error

Can't not find the user-defined function ; or something like that.

I've already put  PUBLIC  FUNCTION  MY_FUNCTION_IN_VB.
I've put that function in a module of my  DATABASE TOO.

Thanks to everybody



Sun, 17 Sep 2000 03:00:00 GMT  
 HELP, I need Somebody, HELP :)) - SQL

Hi,

Some ODBC drivers do not accept functions when they are called. It would
be better if you evaluated your function first to return a result and
then pass it to the SQL statement.

Usually SQLs are parsed as

SELECT TABLENAME.FIELDS
FROM TABLENAME
WHERE TABLENAME.FIELD1 = USER_CRITERIA

Hope this helps.
Ricardo H.Marshall

Quote:
> -----Original Message-----


> Posted At: Wednesday, April 01, 1998 7:52 AM
> Posted To: database
> Conversation:      HELP, I need Somebody, HELP   :)) -   SQL
> Subject:   HELP, I need Somebody, HELP   :)) -   SQL

> Hi there.

> I usually find out how to solve my problems by my own. But I got no
> time anymore to find that answer.

> I got this SQL in my VB5 Application.

> SELECT * FROM CLIENTS WHERE MY_FUNCTION_IN_VB( Field ) = TRUE.

> Why is it not  working ?
> It keeps answer me that error

> Can't not find the user-defined function ; or something like that.

> I've already put  PUBLIC  FUNCTION  MY_FUNCTION_IN_VB.
> I've put that function in a module of my  DATABASE TOO.

> Thanks to everybody



Sun, 17 Sep 2000 03:00:00 GMT  
 HELP, I need Somebody, HELP :)) - SQL

You can't put a VB or Access Function directly into an SQL string.

The SQL parser does not know anything about VB or Access, it is there to
validate only know functions and procedures.

If you were running the SQL directly from Access then it would pick up your
pubic
function declared in its module and use it. But since you are calling the
function
from VB it cannot do this. Like-wise VB cannot determine your function
because it
is encloded in Quotes and is beeing passed onto the SQL parser. I assume
your
code looks some-thing like the following.

Dim strSQL as string
Dim Rs As recordset

strSQL = "Select * from [Table] Where MYFunction = [Field]"
Set RS = Db.OpenRecordset(strSQL, dbOpenDynaset)

The strSQL variable passed over to the database can only contain valid
functions that Access or which-ever database you are using can understand.

There are a number of work-arounds but would need an example of what you
are
trying to achive.



Quote:

> Hi there.

> I usually find out how to solve my problems by my own. But I got no
> time anymore to find that answer.

> I got this SQL in my VB5 Application.

> SELECT * FROM CLIENTS WHERE MY_FUNCTION_IN_VB( Field ) = TRUE.

> Why is it not  working ?
> It keeps answer me that error

> Can't not find the user-defined function ; or something like that.

> I've already put  PUBLIC  FUNCTION  MY_FUNCTION_IN_VB.
> I've put that function in a module of my  DATABASE TOO.

> Thanks to everybody



Wed, 20 Sep 2000 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Can somebody please help me with SQL?

2. Can somebody please help me with SQL? (Appended)

3. HELP! Newbie needs help with SQL for VB3

4. Need Report to look at SQL Data source ( VB / CR newbie needs help)

5. help, help, help...I'm begging here :-\ RE RE POST simple code help needed

6. help,help,help,help,help,help,help,help,help,help,help,help,help,

7. HELP HELP HELP, Need help, in IE Control

8. Can somebody help me??

9. Help : Somebody else must have come across this!

10. Somebody who knows about Access97 Please Help!

11. Please somebody help me.

12. Somebody help, please

 

 
Powered by phpBB® Forum Software