Solved

Why do I get "System Resource exceeded" when I linked second & successive Excel tables

Posted on 2004-04-23
3
1,495 Views
Last Modified: 2007-12-19
Public Sub Per_VatCodeData(ByVal Period As Long, ByVal CoyCode As String, ByVal VatCode As String, ByVal VatBook As String)

Dim tdfLink As TableDef
I need to use SQL to append data to a series of Excel sheets which I was trying to link to an Access MDB using the following fragment of code in a repeatedly executed Sub:
****************************
Set tdfLink = CurrentDb.CreateTableDef("tblVatSheet")
tdfLink.Connect = "Excel 8.0;DATABASE=" & VatBook
tdfLink.SourceTableName = VatCode & "dyn"
CurrentDb.TableDefs.Append tdfLink         <------------------------------------------------ Stops here

str = Xql_RecordSet(VatCode)
DoCmd.RunSQL str

Set tdfLink = Nothing
CurrentDb.TableDefs.Delete "tblVatSheet"
*************************
Unfortunately, although it works once, it subsequently stops with the error 3035 and message "System Resource exceeded".
Am I doing something wrong? Does anyone have a solution? This should be the fastest way of doing what I wish, if only .....

Thanks
0
Comment
Question by:TonyWootton
3 Comments
 
LVL 11

Accepted Solution

by:
phileoca earned 100 total points
ID: 10901507
0
 

Author Comment

by:TonyWootton
ID: 11396475
Hi phileoca,

Although I am grateful for your response and I've looked at both the questions you refer to, whilst the error message I get is the same, I don't think that the cause is. Since I asked it, I've tried linking all of the sheets before populating them. That worked for all 22. I am then able to write to the first attached sheet, but then to no others. I am subsequently unable to even open any of the attached sheets, least of all to write to them. My suspicion is that there is some kind of problem with the DAO/ODBC mechanism, though I have no idea what and I have been unable to find away to correct it.

I therefore tried another route, by using automation to make Access control Excel which then sucks data out of Access. A somewhat roundabout route, except that it works quite quickly until Excel doesn't quite terminate properly (see Q_21029622.html). Fortunately I've found a workaround


0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now