473,396 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Issue with TransferSpreadsheet into existing Excel file.

53
Hi,

I am trying to use the transferspreadsheet command to transfer a table into an excel file i have. I'm using the following code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdOK_Click()
  2.     'Run Make-Table query without warnings so I can export the updated table later
  3.     DoCmd.SetWarnings False
  4.     DoCmd.OpenQuery "qryPriLis", acViewNormal
  5.     DoCmd.Close acTable, "Perpetual"
  6.     DoCmd.SetWarnings True
  7.  
  8.     Dim path As String
  9.     Dim Xl As Object
  10.     Dim xlsheet As Object
  11.     path = "C:\See Through June 2007.xls"
  12.  
  13.     'Open Excel file and make it visible and turn off warnings
  14.     Set Xl = GetObject(path)
  15.     Xl.Application.Visible = True
  16.     Xl.Parent.Windows(1).Visible = True
  17.     Set xlsheet = Xl.Worksheets(22)
  18.     Xl.Application.DisplayAlerts = False
  19.  
  20.     'Delete the worksheet and then transfer in the new data
  21.     xlsheet.Delete
  22.     DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "Perpetual", path, , "Perpetual"
  23.  
  24.     'Save, turn warnings back on, quit and release variables
  25.     Xl.Application.Save
  26.     Xl.Application.DisplayAlerts = True
  27.     Xl.Application.Quit
  28.     Set Xl = Nothing
  29.     Set xlsheet = Nothing
  30. End Sub
  31.  
The issue is with the transferspreadsheet part. I get a "Runtime Error 3422: Cannot modify table structure. Another User has the table open." Everything before and after it works fine.

If anyone has any insight, it's well appreciated.

Raza
Sep 21 '07 #1
2 3041
Stang02GT
1,208 Expert 1GB
Is this DB shared over a network?

Becuse it sounds like from the error message that someone has your DB open on another machine, which wouldn't allow you to do anything to it. Check and make sure that when you attept to run this code that you are the only person in the DB.
Sep 21 '07 #2
RZ15
53
I am running it off my harddrive. The data is on a server, but I made it a make-table query for that purpose.

I don't think that is the problem.
Sep 21 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Nathan Bloom | last post by:
Hi, I have a procedure that transfer data from an Excel spreadsheet to an Access 2000 table. There is a start date and an end date in the range specified. One of the date fields transfers...
0
by: Mick Hardy | last post by:
Hi, Has anyone seen this weird behaviour or have any suggestions or can anyone reproduce it? The history: I converted a large third party DB from 97 to XP and it uses the...
1
by: barma16 | last post by:
I've hit a bit of a brick wall here, and could use some advice. I have an Access application whose output is a four-tab Excel spreadsheet where three of the four tabs are the result of database...
2
by: Anne Sachleben via AccessMonster.com | last post by:
I am using the TransferSpreadsheet function to export a query result to a specific worksheet in an Excel file titled "report". I want the result to be exported to the worksheet titled "facts". ...
13
by: aleksandra_83 | last post by:
Hello, I have searched all over google groups and internet, but I have not found a solution to this problem that has worked. The solutions I found helped me single out the line that is causing...
2
by: rlntemp-gng | last post by:
re:Access 2003 TransferSpreadsheet has worked in my app for weeks now. Now, the day I was to put in production (today) it crashes the app, and users are livid...but not more than me...
5
by: D.Stone | last post by:
I'm getting a problem with importing an Excel spreadsheet into a table in a SQL Server 2000 back-end. I'm doing this in VBA in an onClick event proc in an Access 2003 project. The target table's...
3
by: Icarus | last post by:
I'm using TransferSpreadsheet to import an Excel file in to MS Access 2003. DoCmd.TransferSpreadsheet acImport, 8, strTable, strFileName, True, "" One of the columns in the Excel file is a...
2
by: AlenaMezh | last post by:
Hello! My Code destroys Excel's normal work.After running this code I acan' open excel file as normal. Do you know why? Please, answer. Public Function import_test_1() Dim objXL As Object Dim...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.