Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,365
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,365
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
error on opening file - pivot table oldLearner57 Excel Discussion (Misc queries) 0 December 2nd 07 07:29 AM
When opening Excel - get Access (Read-Only) file and error DeltaDagger Setting up and Configuration of Excel 1 October 31st 06 10:22 AM
Pivot table error when Opening an Xml Spreadsheet from MS excel Xp Jagadeesan Charts and Charting in Excel 0 October 16th 06 07:58 AM
Importing data from Access to Excel, but I need to vary the table from Access Liz L. Excel Programming 3 June 6th 06 02:12 AM
Error opening recordset where table is empty (but has field names) - How do I avoid? Alan Excel Programming 1 October 10th 05 07:43 AM


All times are GMT +1. The time now is 04:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"