Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error Opening Access Table in VBA
Greetings:
I have the following VBA code attempting to open a table in my ACCESS database: Sub GetLast30() Dim wksp As DAO.Workspace Dim dbs As DAO.Database Dim rst1 As DAO.Recordset Dim rng As Range Set wksp = DAO.CreateWorkspace("wksp", "admin", "", dbUseJet) Set dbs = wksp.OpenDatabase("TASS Alarms.mdb") Set rst1 = dbs.OpenRecordset("tblAlarmsCook") |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error Opening Access Table in VBA
The program worked after I provided a full path.
Thanks for your help. Charles "JLatham" wrote: I just copied your code and changed nothing but the path/filename for a .mdb file on my system and a table name within it and had no trouble accessing the fields in the table. #1 - check that the database is in the current directory, or provide a full path to the .mdp file when you use the .OpenDatabase command. Check in Excel VBEditor to make sure you have Tools | References set to both the Microsoft Access Library and to the DAO 3.6 Object library. "Charles in Iraq" wrote: Greetings: I have the following VBA code attempting to open a table in my ACCESS database: Sub GetLast30() Dim wksp As DAO.Workspace Dim dbs As DAO.Database Dim rst1 As DAO.Recordset Dim rng As Range Set wksp = DAO.CreateWorkspace("wksp", "admin", "", dbUseJet) Set dbs = wksp.OpenDatabase("TASS Alarms.mdb") Set rst1 = dbs.OpenRecordset("tblAlarmsCook") . . . End Sub But when I attempt the run this code, I get the following error: Run-time error '3078': The Microsoft Jet dtabase engine cannot find the input table or query 'tblAlarmsCook'. Make sure it exists and that its name is spelled correctly. Needless to say, this table definitely exists and its name is spelled correctly. So why am I getting this error? Is there some other property I need to set to correctly open this table? Regards, Charles |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error Opening Access Table in VBA
I just copied your code and changed nothing but the path/filename for a .mdb
file on my system and a table name within it and had no trouble accessing the fields in the table. #1 - check that the database is in the current directory, or provide a full path to the .mdp file when you use the .OpenDatabase command. Check in Excel VBEditor to make sure you have Tools | References set to both the Microsoft Access Library and to the DAO 3.6 Object library. "Charles in Iraq" wrote: Greetings: I have the following VBA code attempting to open a table in my ACCESS database: Sub GetLast30() Dim wksp As DAO.Workspace Dim dbs As DAO.Database Dim rst1 As DAO.Recordset Dim rng As Range Set wksp = DAO.CreateWorkspace("wksp", "admin", "", dbUseJet) Set dbs = wksp.OpenDatabase("TASS Alarms.mdb") Set rst1 = dbs.OpenRecordset("tblAlarmsCook") . . . End Sub But when I attempt the run this code, I get the following error: Run-time error '3078': The Microsoft Jet dtabase engine cannot find the input table or query 'tblAlarmsCook'. Make sure it exists and that its name is spelled correctly. Needless to say, this table definitely exists and its name is spelled correctly. So why am I getting this error? Is there some other property I need to set to correctly open this table? Regards, Charles |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error Opening Access Table in VBA
You're welcome. Glad it turned out to be that easy. The devil is in the
details. "Charles in Iraq" wrote: The program worked after I provided a full path. Thanks for your help. Charles "JLatham" wrote: I just copied your code and changed nothing but the path/filename for a .mdb file on my system and a table name within it and had no trouble accessing the fields in the table. #1 - check that the database is in the current directory, or provide a full path to the .mdp file when you use the .OpenDatabase command. Check in Excel VBEditor to make sure you have Tools | References set to both the Microsoft Access Library and to the DAO 3.6 Object library. "Charles in Iraq" wrote: Greetings: I have the following VBA code attempting to open a table in my ACCESS database: Sub GetLast30() Dim wksp As DAO.Workspace Dim dbs As DAO.Database Dim rst1 As DAO.Recordset Dim rng As Range Set wksp = DAO.CreateWorkspace("wksp", "admin", "", dbUseJet) Set dbs = wksp.OpenDatabase("TASS Alarms.mdb") Set rst1 = dbs.OpenRecordset("tblAlarmsCook") . . . End Sub But when I attempt the run this code, I get the following error: Run-time error '3078': The Microsoft Jet dtabase engine cannot find the input table or query 'tblAlarmsCook'. Make sure it exists and that its name is spelled correctly. Needless to say, this table definitely exists and its name is spelled correctly. So why am I getting this error? Is there some other property I need to set to correctly open this table? Regards, Charles |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
error on opening file - pivot table | Excel Discussion (Misc queries) | |||
When opening Excel - get Access (Read-Only) file and error | Setting up and Configuration of Excel | |||
Pivot table error when Opening an Xml Spreadsheet from MS excel Xp | Charts and Charting in Excel | |||
Importing data from Access to Excel, but I need to vary the table from Access | Excel Programming | |||
Error opening recordset where table is empty (but has field names) - How do I avoid? | Excel Programming |