473,385 Members | 1,641 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,385 software developers and data experts.

importing spreadsheet to a database that's not the CurrentDB

I am trying to use DoCmd.TranferSpreadsheet to import a spreadsheet
into an Access table that's not the CurrentDB. I have the database
open, but I don't see how to tell the TransferSpreadsheet command that
the table is not in the CurrentDB. Is there a way to specify a
filename and table within the table string of the TransferSpreadsheet
command? Is there a way of temporarily changing the CurrentDB to be
the other database so the TransferSpreadsheet command will do what I
want? Any other ideas? Thanks.
Nov 12 '05 #1
4 4932
On 7 Jan 2004 14:29:05 -0800, hh*****@harris.com (Howard) wrote:
I am trying to use DoCmd.TranferSpreadsheet to import a spreadsheet
into an Access table that's not the CurrentDB. I have the database
open, but I don't see how to tell the TransferSpreadsheet command that
the table is not in the CurrentDB. Is there a way to specify a
filename and table within the table string of the TransferSpreadsheet
command? Is there a way of temporarily changing the CurrentDB to be
the other database so the TransferSpreadsheet command will do what I
want? Any other ideas? Thanks.


Either create a link to the table in the other database, and import into that
(if importing into an existing table), or use Automation, to open another
instance of Access, and do the import using <application
instance>.DoCmd.TransferSpreadsheet.
Nov 12 '05 #2
Just suggesting one more alternative: you could link a table from the
external mdb to your current mdb and use TransferSpreadsheet to the
linked table. And something even a little more reliable than that would
be to Transferspreadsheet to a local table in the current mdb and use
Insert Into to fill the linked table.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #3
Thanks for the help. I got it working now, but of course, now I have
another question...

I have a column in the spreadsheet that has mostly numbers but has a
couple of text entries at the end. The Access Table that I'm
importing this data into is defined to have all text fields. When I
do the import function (TransferSpreadsheet), I get an error (Numeric
Field Overflow). Now, if I change the text entries to numbers (I
don't mean the formating - I mean the actual values), then it works
fine.

It seems like the import function assumes that the spreadsheet field
is a number field (maybe because that's what was in all the previous
rows) and when it gets to the text data, it messes up. Shouldn't it
use the table definition from Access to determine how to import the
data from the spreadsheet? Changing the format of the spreadsheet to
all text fields had no affect.

Any ideas as to why this is happening? Any suggestions as to how to
fix it?

Rich P <rp*****@aol.com> wrote in message news:<3f***********************@news.frii.net>...
Just suggesting one more alternative: you could link a table from the
external mdb to your current mdb and use TransferSpreadsheet to the
linked table. And something even a little more reliable than that would
be to Transferspreadsheet to a local table in the current mdb and use
Insert Into to fill the linked table.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #4
Create an import specification, and set the field types there. Then
pass the specification name as an argument in the TransferSpreadsheet
command. Then it should use the spec and know that you intended that
field to be text.
Nov 12 '05 #5

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

Similar topics

4
by: Little PussyCat | last post by:
Hello, I nee to write something that will transfer excel data into an SQL Server table. I have for another database application I wrote have it importing Excel spreadsheet data using cell by...
9
by: Edward S | last post by:
I budget for a Project in an Excel sheet as illustrated below. The months below are usually a 2 year period i.e. 24 months, though it could be over 24 months depending upon a Project. I then...
5
by: dixie | last post by:
If I sent a user an empty database container - dB with no tables and I needed them to import their tables into it and one of their tables was a hidden table with the prefix Usys, is there any way...
9
by: jillandgordon | last post by:
I am trying to import an excel file into Access 97. It looks perfectly all right but, every time I try to import it, I get to the lst step and am told that it was not imported due to an error. ...
1
by: Geoff Jones | last post by:
Hi I have a question which I hope somebody can answer. I have written a VB application with which I want to import an Excel file, analyze the data within it and do some calculations. There are...
6
by: syvman | last post by:
Hi everyone... I am pulling my hair out trying to do this, and was wondering if someone could give me some assistance... I have an Excel spreadsheet containing several worksheets. I'd like to be...
0
by: DrewYK | last post by:
I have the project that may never end in front of me. I am creating a routine that will take SpreadSheets from Excel and bring them into Access. I am not using any "DoCmd"s because the goal...
4
by: Bongard | last post by:
I have a dynamic range that I would like to use as a linked table into Access. The problem is that Access doesn't seem to want to to recognize the dynamic range when you click on "show named...
2
anoble1
by: anoble1 | last post by:
I have a button in my database that when you hit tit, it imports just 1 excel sheet and puts it in a table. Works great. I am wanting to grab 4 more excel sheets from different locations and store...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.