Mille
Mille

Reputation: 743

db.Execute sql with reference to stored procedure

I've started to use CurrentDb.Execute to handle all my queries because it seams to most usable. The problem which I encountered when switching from DoCmd.RunSQL to CurrentDb.Execute is that references to stored procedures inside the SQL string isn't working.

UPDATE tbl SET x = 1 WHERE id IN (SELECT id FROM [MyProc])

Does it need to be evaluated somehow, or is there something else that is wrong?

Upvotes: 0

Views: 286

Answers (1)

Fionnuala
Fionnuala

Reputation: 91316

In VBA you can to refer to the form like so:

ssql = "SELECT * FROM tbl2 WHERE " & Me.Are & "=tbl2.col"

So MyProc can either be dropped or rewritten.

(See also UPDATE query based on a saved SELECT query in Access? )

Upvotes: 1

Related Questions