Error 3065 cannot execute Select query but it's :NOT a select query

I get this error when I try to execute this query.  Identical piece of code works in another database against the same ODBC connection.  This is a passthrough query to a mysql database.  Here is the code til it fails.  As you can see, it is NOT a select query.  What's up with that?

Function ContactsBreakOut()
   Dim rs As ADODB.Recordset
   Dim rSELECT As String
   Dim TNAME As String
DoCmd.SetWarnings False
   Set rs = New ADODB.Recordset
   rs.Open "territory", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
   'Fix Big Selects
rSELECT = "SET SQL_BIG_SELECTS=1;"
Set DB = CurrentDb()
    Set Q = DB.QueryDefs("Fixit")
    Q.SQL = rSELECT
    Q.Close
    'Run the query.
    CurrentDb.Execute "Fixit", dbFailOnError
 
Question Info

Last updated February 11, 2018 Views 4,002 Applies to:
Answer
I get this error when I try to execute this query.  Identical piece of code works in another database against the same ODBC connection.  This is a passthrough query to a mysql database.  Here is the code til it fails.  As you can see, it is NOT a select query.  What's up with that?

Function ContactsBreakOut()
   Dim rs As ADODB.Recordset
   Dim rSELECT As String
   Dim TNAME As String
DoCmd.SetWarnings False
   Set rs = New ADODB.Recordset
   rs.Open "territory", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
   'Fix Big Selects
rSELECT = "SET SQL_BIG_SELECTS=1;"
Set DB = CurrentDb()
    Set Q = DB.QueryDefs("Fixit")
    Q.SQL = rSELECT
    Q.Close
    'Run the query.
    CurrentDb.Execute "Fixit", dbFailOnError

Is the querydef "Fixit" defined and set up as a pass-through query, with a Connect property set to address the MySQL database in question?  Is its ReturnsRecords property set to No?
Dirk Goldgar, MS Access MVP 2001-2015
Access tips: www.datagnostics.com/tips.html

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.