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

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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