Setting the Type Property on a Temporary Pass-Thru Query

whdyck

Registered User.
Local time
Today, 04:23
Joined
Aug 8, 2011
Messages
169
I'm using MS Access 2003.

I need to create a temporary pass-thru query with Type = dbQSPTBulk. Here's my code:

Code:
' Create a temporary pass-thru query
Set qdTemp = db.CreateQueryDef("")
 
' Set properties of temp pass-thru query
qdTemp.Connect = strConnectString
qdTemp.ODBCTimeout = lngOdbcTimeout
qdTemp.SQL = pstrSQL
qdTemp.ReturnsRecords = False
qdTemp.Type = dbQSPTBulk

However, the last line of code fails to compile with the error "Can't assign to read-only property".

Is there any other way to do this?

Why do I want to do this, you ask? Because I need to replicate an existing *saved* pass-thru query as a temp query, and when I examine the saved query's properties, it says that its Type = 144, which matches the constant dbQSPTBulk. The above code (minus the last line) produces a QueryDef with Type = 0.

Or does the Type really matter in this case?

Thanks for any help you can give.

Wayne
 
According to this page:

http://office.microsoft.com/en-us/access-help/HV080753695.aspx

That constant is only supported for "Microsoft Access workspaces".

Here is a snippet of my code which creates a DAO.QueryDef in Pass-Through mode.

Code:
  Dim daoDB As DAO.Database
  Dim daoQDFbe As DAO.QueryDef

  'Attach to the FE DB
  Set daoDB = CurrentDb()

  'Build the BE PT Query
  Set daoQDFbe = daoDB.CreateQueryDef(strQryNameBE)
  With daoQDFbe
    .Connect = ObjAppSettings.ODBCConnectString()
    .SQL = strSQLbe
    .Close
  End With

  'Clean up the connection to the database
  Set daoQDFbe = Nothing
  Set daoDB = Nothing
Full post here:
Example of DAO.QueryDef objects downloading records from a SQL BE DB via Pass-Through query and populating a FE temp table with them
http://www.access-programmers.co.uk/forums/showthread.php?p=1119605#post1119605
 

Users who are viewing this thread

Back
Top Bottom