Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default runtime error 3343

Attempting to copy an Access query into Excel.
All References [dao, etc] are set properly, and all syntax below is correct.

DEBUG lands here ...
("D:\ExcTst.accdb")
Set MyQueryDef = MyDatabase.QueryDefs("qryTest_ToExcel")
.... And Runtime Error 3343 / Unrecognized Database Format appears.

How can this be fixed?
Thanx,
- Mike


*** Here's the first part of the code in entirety:

Sub RunAccessTestQuery()

Dim MyDatabase As DAO.Database
Dim MyQueryDef As DAO.QueryDef
Dim MyRecordset As DAO.Recordset
Dim i As Integer

Set MyDatabase = DBEngine.OpenDatabase _
("D:\ExcTst.accdb")
Set MyQueryDef = MyDatabase.QueryDefs("qryTestToExcel")

Set MyRecordset = MyQueryDef.OpenRecordset
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default runtime error 3343

first look at vba help

CreateQueryDef Method Example

Second I would record a macro and then go to the worksheet and try the query
manually from the menu

Data - Import External Data - New Database Query

Then select the query and see if it works. The recorded mqacro should give
you the proper syntax.

"MikeF" wrote:

Attempting to copy an Access query into Excel.
All References [dao, etc] are set properly, and all syntax below is correct.

DEBUG lands here ...
("D:\ExcTst.accdb")
Set MyQueryDef = MyDatabase.QueryDefs("qryTest_ToExcel")
... And Runtime Error 3343 / Unrecognized Database Format appears.

How can this be fixed?
Thanx,
- Mike


*** Here's the first part of the code in entirety:

Sub RunAccessTestQuery()

Dim MyDatabase As DAO.Database
Dim MyQueryDef As DAO.QueryDef
Dim MyRecordset As DAO.Recordset
Dim i As Integer

Set MyDatabase = DBEngine.OpenDatabase _
("D:\ExcTst.accdb")
Set MyQueryDef = MyDatabase.QueryDefs("qryTestToExcel")

Set MyRecordset = MyQueryDef.OpenRecordset

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default runtime error 3343

Joel,
Thanx for the info.
Nothing works.

*Except* ...
If I open a brand new file, insert a module, copy this code to it, hit f5
--- it runs just fine.
It doesn't make sense.
... At least to me.

"joel" wrote:

first look at vba help

CreateQueryDef Method Example

Second I would record a macro and then go to the worksheet and try the query
manually from the menu

Data - Import External Data - New Database Query

Then select the query and see if it works. The recorded mqacro should give
you the proper syntax.

"MikeF" wrote:

Attempting to copy an Access query into Excel.
All References [dao, etc] are set properly, and all syntax below is correct.

DEBUG lands here ...
("D:\ExcTst.accdb")
Set MyQueryDef = MyDatabase.QueryDefs("qryTest_ToExcel")
... And Runtime Error 3343 / Unrecognized Database Format appears.

How can this be fixed?
Thanx,
- Mike


*** Here's the first part of the code in entirety:

Sub RunAccessTestQuery()

Dim MyDatabase As DAO.Database
Dim MyQueryDef As DAO.QueryDef
Dim MyRecordset As DAO.Recordset
Dim i As Integer

Set MyDatabase = DBEngine.OpenDatabase _
("D:\ExcTst.accdb")
Set MyQueryDef = MyDatabase.QueryDefs("qryTestToExcel")

Set MyRecordset = MyQueryDef.OpenRecordset

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default runtime error 3343

Access unlike excel is not forward and backwards compatable. With Access
when you get a new version of Access it upgrades the database and makes it
incompatable with previous versions of Access. With Access if you want to
use a database with an earlier version of Access you have to save it in the
earlier version and then it is no longer compatable with the new version.
The database has a version ID in the file to indicate which version of access
it can be used with.

All microsoft office product keep the same file structure. Office products
have Tables, Documents, Pictures, Slices. The .XLS file, .DOC file, .MDB
file, .PPT file all have the same top level structure that can contain
Tables, Documents, Pictures, slides. A Table can be an Excel Sheet, a Access
Table, a Word Table. All the same. Each ahve a version number inbedded in
the Table.

I think you problem is the Worksheet version number isn't compatible with
the Access Table version number. Is that simple enough explanation?

"MikeF" wrote:

Joel,
Thanx for the info.
Nothing works.

*Except* ...
If I open a brand new file, insert a module, copy this code to it, hit f5
--- it runs just fine.
It doesn't make sense.
.. At least to me.

"joel" wrote:

first look at vba help

CreateQueryDef Method Example

Second I would record a macro and then go to the worksheet and try the query
manually from the menu

Data - Import External Data - New Database Query

Then select the query and see if it works. The recorded mqacro should give
you the proper syntax.

"MikeF" wrote:

Attempting to copy an Access query into Excel.
All References [dao, etc] are set properly, and all syntax below is correct.

DEBUG lands here ...
("D:\ExcTst.accdb")
Set MyQueryDef = MyDatabase.QueryDefs("qryTest_ToExcel")
... And Runtime Error 3343 / Unrecognized Database Format appears.

How can this be fixed?
Thanx,
- Mike


*** Here's the first part of the code in entirety:

Sub RunAccessTestQuery()

Dim MyDatabase As DAO.Database
Dim MyQueryDef As DAO.QueryDef
Dim MyRecordset As DAO.Recordset
Dim i As Integer

Set MyDatabase = DBEngine.OpenDatabase _
("D:\ExcTst.accdb")
Set MyQueryDef = MyDatabase.QueryDefs("qryTestToExcel")

Set MyRecordset = MyQueryDef.OpenRecordset

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
runtime error '1004' application or object defined error Janis Excel Programming 4 November 18th 09 03:01 PM
Run Time Error 3343 - Unrecognized database format: Maury Markowitz[_2_] Excel Programming 4 May 29th 08 09:13 AM
runtime error 13 - type mismatch error in Excel 97 on Citrix Kevin Maher Excel Programming 7 March 8th 08 11:48 AM
runtime error '1004' application or object defined error. Please help deej Excel Programming 0 August 1st 07 09:26 AM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM


All times are GMT +1. The time now is 09:35 PM.

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"