Stored Procedure vs Query

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.
 
A

AnExpertNovice

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.
 
Top