Stored Procedure vs Query

  • Thread starter Thread starter AnExpertNovice
  • Start date Start date
A

AnExpertNovice

cnn.Execute CommandText:="[QueryName]", _
RecordsAffected:=vbNullString, _
Options:=adCmdStoredProc Or adExecuteNoRecords

has been used instead of "DoCmd.RunSQL".

The Query was changed but executing the VBA code still uses the previous
query. I obviously do not understand Stored Procedures because when
anything about them is read it never seems to pertain to anything within an
Access database.

Can someone help with how to update the "StoredProcedure" or a better method
of executing a Query from VBA. DAO is not referenced since ADO is being
used.
 
First, I recreated the query with a completely different name.

Excecuting it directly works fine (98 records are appended).

Executing it from VBA using DoCmd.OpenQuery "QueryName" works fine (98
records are appended)

Executing it using appends117 records instead of 98.
cnn.Execute CommandText:="[QueryName]", _
RecordsAffected:=vbNullString, _
Options:=adCmdStoredProc Or adExecuteNoRecords

Quite frustrating.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top