Home All Groups Group Topic Archive Search About

Programmatically creating a pass-through query

Author
17 May 2010 8:18 PM
Ben
Hi,

Is there a way to programmatically create pass-through query in Access 2003?

Sub test ()

    Dim db              As Database
    Dim strSQL          As String
    Dim qdfs            As QueryDefs
    Dim qdf             As QueryDef

    strSQL ="Some pass-through SQL statement here"

    Set db = CurrentDb
    Set qdfs = db.QueryDefs
    Set qdf = db.CreateQueryDef("qry_PassThru", strSQL)
    qdf.SQL = strSQL

End Sub

But the code about will not create a pass-through query, Access thinks
it is a regular Access query.  Is there a way to specify in code the
type of query it is?  Thanks for sharing your thoughts.


Ben

Author
17 May 2010 10:11 PM
Armin Zingler
Am 17.05.2010 22:18, schrieb Ben:
Show quoteHide quote
> Hi,
>
> Is there a way to programmatically create pass-through query in Access 2003?
>
> Sub test ()
>
>     Dim db              As Database
>     Dim strSQL          As String
>     Dim qdfs            As QueryDefs
>     Dim qdf             As QueryDef
>
>     strSQL ="Some pass-through SQL statement here"
>
>     Set db = CurrentDb
>     Set qdfs = db.QueryDefs
>     Set qdf = db.CreateQueryDef("qry_PassThru", strSQL)
>     qdf.SQL = strSQL
>
> End Sub
>
> But the code about will not create a pass-through query, Access thinks
> it is a regular Access query.  Is there a way to specify in code the
> type of query it is?  Thanks for sharing your thoughts.


Even though this is a VB.Net group (which will be dead soon),
the "dbQSQLPassThrough" value should make it:

http://msdn.microsoft.com/en-us/library/bb257317(office.12).aspx


--
Armin
Author
18 May 2010 2:42 PM
Ben
Thanks Armin.

Ben

On 5/17/2010 6:11 PM, Armin Zingler wrote:
Show quoteHide quote
> Am 17.05.2010 22:18, schrieb Ben:
>> Hi,
>>
>> Is there a way to programmatically create pass-through query in Access 2003?
>>
>> Sub test ()
>>
>>      Dim db              As Database
>>      Dim strSQL          As String
>>      Dim qdfs            As QueryDefs
>>      Dim qdf             As QueryDef
>>
>>      strSQL ="Some pass-through SQL statement here"
>>
>>      Set db = CurrentDb
>>      Set qdfs = db.QueryDefs
>>      Set qdf = db.CreateQueryDef("qry_PassThru", strSQL)
>>      qdf.SQL = strSQL
>>
>> End Sub
>>
>> But the code about will not create a pass-through query, Access thinks
>> it is a regular Access query.  Is there a way to specify in code the
>> type of query it is?  Thanks for sharing your thoughts.
>
>
> Even though this is a VB.Net group (which will be dead soon),
> the "dbQSQLPassThrough" value should make it:
>
> http://msdn.microsoft.com/en-us/library/bb257317(office.12).aspx
>
>