Cannot execute a select query.

  • Thread starter Thread starter Julie R.
  • Start date Start date
J

Julie R.

In a module I have a Sub called generateSCHConFile(). I
create a string with the query. Then I call
CurrentDb.Execute string. I get the following message
Run-time error '3065 Cannot execute a select query. Does
anyone have a clue?
 
Like the message says, the Execute method doesn't work with Select queries
(nor does DoCmd.RunSQL). Both methods work only with Action queries (i.e.
Delete, Insert Into or Update)

If you explain what you're trying to do, perhaps someone will be able to
suggest an alternative.
 
From this Sub I am trying to get a record set. I will put
this data into an array, manipulate it, then write it out
to a text file.
 
In that case, you need to use OpenRecordset method of the Database object
(assuming DAO), or the Open method of the Recordset object (assuming ADO)
 
That worked thanks!
-----Original Message-----
In that case, you need to use OpenRecordset method of the Database object
(assuming DAO), or the Open method of the Recordset object (assuming ADO)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)






.
 
Back
Top