Executing SQL queries using modules via Jet 
Author Message
 Executing SQL queries using modules via Jet

Hiya,

Is there anyway that I can possibly run a SQL command from my Jet 4.0
connection (VB.net) which uses a custom written module? The below code and
subsequent SQL query of
"select getDay(transactionDate) from tblTransaction" runs fine when the DB
is open through Access but I can't run the same query using a Jet
connection. Any ideas? I know about the datepart function but this is just
some test code.

Function getDay(ByVal pDate As String) As Integer
    Dim arrDate() As String

    arrDate = Split(pDate, "/")
    getDate = CInt(arrDate(0))
End Function

Many thanks,
Darryn



Fri, 11 Feb 2005 08:38:52 GMT  
 Executing SQL queries using modules via Jet
Sorry, Darryn, but I believe the answer is 'no'. As I understand it, when
the query is run within Access, Access does the extra work to evaluate the
function for you. When you run the query from outside Access, Access isn't
around to do that.

--
Brendan Reynolds (MVP)

Access 2000/2002 sample app at
http://brenreyn.brinkster.net
----------------------------

Quote:
> Hiya,

> Is there anyway that I can possibly run a SQL command from my Jet 4.0
> connection (VB.net) which uses a custom written module? The below code and
> subsequent SQL query of
> "select getDay(transactionDate) from tblTransaction" runs fine when the DB
> is open through Access but I can't run the same query using a Jet
> connection. Any ideas? I know about the datepart function but this is just
> some test code.

> Function getDay(ByVal pDate As String) As Integer
>     Dim arrDate() As String

>     arrDate = Split(pDate, "/")
>     getDate = CInt(arrDate(0))
> End Function

> Many thanks,
> Darryn



Fri, 11 Feb 2005 19:55:11 GMT  
 Executing SQL queries using modules via Jet
That sounds sad, as jet build-in functions are not adequate, what one can do to get customized functions to work?
Quote:

> Sorry, Darryn, but I believe the answer is 'no'. As I understand it, when
> the query is run within Access, Access does the extra work to evaluate the
> function for you. When you run the query from outside Access, Access isn't
> around to do that.

> --
> Brendan Reynolds (MVP)

> Access 2000/2002 sample app at
> http://brenreyn.brinkster.net
> ----------------------------


> > Hiya,

> > Is there anyway that I can possibly run a SQL command from my Jet 4.0
> > connection (VB.net) which uses a custom written module? The below code and
> > subsequent SQL query of
> > "select getDay(transactionDate) from tblTransaction" runs fine when the DB
> > is open through Access but I can't run the same query using a Jet
> > connection. Any ideas? I know about the datepart function but this is just
> > some test code.

> > Function getDay(ByVal pDate As String) As Integer
> >     Dim arrDate() As String

> >     arrDate = Split(pDate, "/")
> >     getDate = CInt(arrDate(0))
> > End Function

> > Many thanks,
> > Darryn



Fri, 11 Feb 2005 21:42:49 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Executing SQL queries using modules via Jet

2. Using SQL to execute a Query with ANDs and ORs

3. How to execute SQL that queries multiple databases using rdo

4. Using an sql query in a class module

5. Can't save queries to new Jet DB via ADO

6. Executing Queries containing VBA function via ODBC

7. can you execute a database query Via Client side script

8. can you execute a query via Client side script

9. Executing Access action query via ADO

10. Need to Send Query Criteria via a Module

11. : Sending Binary 0 Within a String to Jet Via SQL

12. Datetime: how to insert via jet SQL

 

 
Powered by phpBB® Forum Software