I'm trying to execute an append query. I have a case that works, and
one that returns an object not set error.
THIS WORKS:
Private Sub cmdArchiveRecs_ Click()
BeginTrans
CurrentDb.Execu te "qapp_RecsNotYe tArchived", dbFailOnError
CommitTrans
End Sub
THIS DOESN'T WORK. It returns OBJECT NOT SET on dbLocal.Execute ():
Dim dbLocal As DAO.Database
Private Sub Form_Load()
Set dbLocal = CurrentDb
End Sub
Private Sub Form_Unload(Can cel As Integer)
dbLocal.Close
Set dbLocal = Nothing
End Sub
Private Sub cmdArchiveRecs_ Click()
BeginTrans
dbLocal.Execute "qapp_RecsNotYe tArchived", dbFailOnError
CommitTrans
End Sub
Why isn't "dbLocal" set for the life of the form? Of what value is
setting a reference vice always using CurrentDb?
Thanks,
-Tony M.
one that returns an object not set error.
THIS WORKS:
Private Sub cmdArchiveRecs_ Click()
BeginTrans
CurrentDb.Execu te "qapp_RecsNotYe tArchived", dbFailOnError
CommitTrans
End Sub
THIS DOESN'T WORK. It returns OBJECT NOT SET on dbLocal.Execute ():
Dim dbLocal As DAO.Database
Private Sub Form_Load()
Set dbLocal = CurrentDb
End Sub
Private Sub Form_Unload(Can cel As Integer)
dbLocal.Close
Set dbLocal = Nothing
End Sub
Private Sub cmdArchiveRecs_ Click()
BeginTrans
dbLocal.Execute "qapp_RecsNotYe tArchived", dbFailOnError
CommitTrans
End Sub
Why isn't "dbLocal" set for the life of the form? Of what value is
setting a reference vice always using CurrentDb?
Thanks,
-Tony M.
Comment