Use of Dim and Set for dbengine (0)(0)

L

Liz James

Using Access 2003, a bound form, running query from VBA code using

DBEngine(0)(0).Execute strSQL, dbFailOnError

In the sub to run the query, which of the following are needed when the
database when will be running under runtime on other computers?

Dim db as database

Set db = DBEngine(0),(0) **would you put this just before the line
DBEngine(0)(0).Execute strSQL, dbFailOnError ?

Set db = Nothing ** would you put this just after the line
DBEngine(0)(0).Execute strSQL, dbFailOnError ?
Can any of them be safely left out?

Thankyou in advance for your help
 
S

Steve Schapel

Liz,

You don't need any of the Dim and Set stuff you mentioned.

You will, however, need to declare and define your strSQL variable, for
example...
Dim strSQL As String
strSQL = "DELETE * FROM Somewhere" ' or whatever it is
 

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

Top