473,809 Members | 2,739 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TransferSpreads heet Command

Hi,

I'm automating an import done manually through Get External Data
I have assigned the below code to the onclick event of a command button
on a form but I am getting errors.

DoCmd.TransferS preadsheet (acImport,acspr eadsheettypeexc el97,
allaccounts,"D: \PersonalData\a ll accounts.xls", -1)

I'm not sure why but I am getting a Syntax error.

Also I am eventualy going to get the user to select the file they want
to import, and I can do this through a box on my form, but how do I
refer to the box in the code above?

Thanks

Dec 9 '06 #1
1 2412
On 9 Dec 2006 07:55:11 -0800, keri wrote:
Hi,

I'm automating an import done manually through Get External Data
I have assigned the below code to the onclick event of a command button
on a form but I am getting errors.

DoCmd.TransferS preadsheet (acImport,acspr eadsheettypeexc el97,
allaccounts,"D: \PersonalData\a ll accounts.xls", -1)

I'm not sure why but I am getting a Syntax error.

Also I am eventualy going to get the user to select the file they want
to import, and I can do this through a box on my form, but how do I
refer to the box in the code above?

Thanks
What is allaccounts?
Is that the actual name of the table you wish to import the data into?
Then it must be a string value. Enclose it within quotes "allaccount s"

DoCmd.TransferS preadsheet (acImport,acspr eadsheettypeexc el97,
"allaccounts"," D:\PersonalData \all accounts.xls", -1)
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Dec 9 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7288
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 correctly and the other one transfers as a text field containing a number like 37917. In the spreadsheet both date cells are formatted as a date. The data in both fields are entered as dates (i.e. 10/27/03). The TransferSpreadsheet Command creates...
3
11076
by: user_5701 | last post by:
Hello, I'm getting an error with a Docmd.Transferspreadsheet line of code: DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel2000, "tblTest", pathAndFilename, True The above line works perfectly fine, but when I change the table name argument (tblTest) to the name of a query, it fails and gives the following error:
4
48814
by: Tom Louchbaum | last post by:
I try to use this command to import a spreadsheet "DoCmd.TransferSpreadsheet acImport, 8, tablename & " -tbl", DIR & "Book2.xls", True" and it errors out. If I try to import that same spreadhseet with menu commands directly it works fine. The Docmd.transferspreadsheet command has always worked for me in the past, I will admit the excel file I'm importing is now slghtly different but I cannot figure out why the transfer does not work.
3
4541
by: sranilp | last post by:
Hey All, Actually I need to export the data from Access to Excel particular spreadsheet(ie.Raw Data),so I was using Docmd.Transferspreadsheet but in this syntax where i can give the spreadsheet name. Example: I have a Excelfile name is Inventory.xls,and sheet name is 'Raw Data',so i need Access data should export to Inventory Excel file Raw Data sheet. I tried like this:'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,...
2
2051
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 though..embarrassed is more like it As an outside test, I built a "DummyApp.mdb" with a form, and a command button that only performs a transferspreadsheet on the same Excel file as my production app is using. The DummyApp works fine. what has caused this.
2
3069
by: RZ15 | last post by:
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: Private Sub cmdOK_Click() 'Run Make-Table query without warnings so I can export the updated table later DoCmd.SetWarnings False DoCmd.OpenQuery "qryPriLis", acViewNormal DoCmd.Close acTable, "Perpetual"
5
4985
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 owner is 'dbo', but the database connection is via user 'fred'. password 'bloggs' (say) using SQL Server authentication. User 'fred' is a member of db_owner role. What happens is that TransferSpreadsheet ignores the 'dbo' table and creates a...
3
10985
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 number formatted field, but occasionally a cell in that column will not have a value. When that happens, the code is not returning an error, but I end up with a table of the Import Errors where that blank field value could
6
1486
by: apank | last post by:
Is there a way to differenciate between multiple Excel Spreasheets in an Excel Workbook when writing the code to TransferSpreadsheet? When I do the command now, I only have one worksheet. Example: DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "Test", "c:/test.xls", True Now suppose the workbook had 3 worksheets: "test1", "test2" and "test3". How would I name the file in the code if I only want to pull "test2"? Thank...
0
9603
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10643
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10391
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10121
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7664
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4333
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3862
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.