0

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?

10
  • 1
    Is this pure MS Access or are you referencing another DB? In MS Access, the example above should work. You might like to post the full sql. If, for example, you are referencing a form, you may run into difficulties. Commented Jan 20, 2014 at 16:51
  • Not sure about your question. But the database is in a file on the local machine. Running the query it tells me there is insufficient parameters. And hence the only "special" reference i'm doing is to a stored procedure using []-brackets. Commented Jan 20, 2014 at 17:38
  • 1
    It would be best to post the sql. Commented Jan 20, 2014 at 17:39
  • The sql of MyProc as well :) Commented Jan 20, 2014 at 17:42
  • Ahh... there it was. Thank you very much. Is there a better way to evaluate the form data then Eval("Forms!Name!Box")? Commented Jan 20, 2014 at 17:49

1 Answer 1

1

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? )

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.