"run time error - 462"

J

Jason K

I created a macro that open Access and retrieves some data
using an SQL statement. It works flawlessly the first
time. Then I try to run it a second time and get the
following error: run time error 462 - the remote server
machine does not exist or is unavailable.

Basic Code:
Set Access = CreateObject("Access.Application")
Access.Visible = False
Access.OpenCurrentDatabase ("XXX.mdb")

SQL Statement

Access.DoCmd.SetWarnings False
Access.DoCmd.RunSQL strSQL
Access.DoCmd.SetWarnings True

Set DB = CurrentDb()
Set RST = DB.OpenRecordset("tblTemp", dbOpenTable)

It allows fails where I set DB = CurrentDb()

Please Help!
JK
 
Top