473,385 Members | 1,593 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 .dbf files (Foxpro) to SQL via Access client

Background:

- I'm running MSDE 2000 (not client tools, stored procedure capability,
etc). This may change, but not in the first part of development.

- My Access file is an Access 2002 project (.adp project client
connecting directly to MSDE SQL database - no .mdb involved or local
file tables beyond the .dbfs to be imported).

- Using ODBC to connect to .dbf data sources without a problem (ODBC is
working).

- Using ODBC to connect to MSDE SQL remote server without a problem.
Connections test fine, manual import from within Access works perfectly
(ODBC is working here as well).

Goal:

- To be able to import .dbf files programmatically into MSDE SQL tables
with Access vba. I stress programatically, as the updates will take
place nightly on a scheduled basis (as they currently do in a current
non-sql database system).
Problem:

Whenever I try to use the DoCmd.TransferDatabase function within Access
2002, I receive:

"Run-time error '3011':

The Microsoft Jet database engine could not find the object
'tblMySQLtableName'. Make sure the object exists and that you spell
its name and the path name correctly."

The code that I'm using is as follows:

DoCmd.TransferDatabase acImport, "ODBC", _
"ODBC;DSN=myDSN;SourceD*B=h:\myPath\;SourceType=DB F", _
acTable, "sourcetable.dbf", "tblMySQLtableName"

Linking to external tables isn't allowed by Access as the database is
currently set up.

Additionally, if I have the table, tblMySQLtableName, already created
within the SQL database, the error message indicates that the
tblMySQLtableName1 object could not be found. To me, this indicates
that the source and destination are both recognized and the
TransferDatabase function is attempting (properly so) to create a new
table rather than overwriting or appending to an existing table, but it
stalls on the creation of the new table.

Question:

Does anyone have suggestions (read: example code) of what might be a
good way to either overcome the above problem or perhaps a better way
of accomplishing the same goal, keeping in mind that stored procedures
and most of the DTS functionality isn't available in MSDE?

Thanks in advance,

JBH

Nov 13 '05 #1
1 4434
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

TransferDatabase only works on JET .mdb files, not .adp files. JET is
the acronym for Joint Engine Technology. This means it can read various
db Engines; .dbf files (XBase type) being one of those. This means you
will have to use JET to read the .dbf files. For ADO you'd use the

Microsoft.Jet.OLEDB.4.0

Provider in the connection string. Perhaps you could open a recordset
on the .dbf file (using JET's OleDB driver) & open a recordset on the
MSDE table(s) (using SQL's OleDB driver) & copy the contents into the
MSDE table(s).

Stored procedures are available in MSDEs. When connected to the MSDE db
look in the Queries tab of the Access (.adp) database window. Click the
New button and double click "Design Stored Procedure." If you cannot
create a stored procedure you may not have permission to create on the
connected db. You have to be a part of the db_ddladmin role or a
sysadmin.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQj+X+IechKqOuFEgEQJNDACfSEHaZpiEHXw+b7Z4tV2X1T AkmXwAoPnj
cEhqHSs05+3xLovT5YtAC8wb
=ZPtK
-----END PGP SIGNATURE-----

JoeBobHankey wrote:
Background:

- I'm running MSDE 2000 (not client tools, stored procedure capability,
etc). This may change, but not in the first part of development.

- My Access file is an Access 2002 project (.adp project client
connecting directly to MSDE SQL database - no .mdb involved or local
file tables beyond the .dbfs to be imported).

- Using ODBC to connect to .dbf data sources without a problem (ODBC is
working).

- Using ODBC to connect to MSDE SQL remote server without a problem.
Connections test fine, manual import from within Access works perfectly
(ODBC is working here as well).

Goal:

- To be able to import .dbf files programmatically into MSDE SQL tables
with Access vba. I stress programatically, as the updates will take
place nightly on a scheduled basis (as they currently do in a current
non-sql database system).
Problem:

Whenever I try to use the DoCmd.TransferDatabase function within Access
2002, I receive:

"Run-time error '3011':

The Microsoft Jet database engine could not find the object
'tblMySQLtableName'. Make sure the object exists and that you spell
its name and the path name correctly."

The code that I'm using is as follows:

DoCmd.TransferDatabase acImport, "ODBC", _
"ODBC;DSN=myDSN;SourceD*B=h:\myPath\;SourceType=DB F", _
acTable, "sourcetable.dbf", "tblMySQLtableName"

Linking to external tables isn't allowed by Access as the database is
currently set up.

Additionally, if I have the table, tblMySQLtableName, already created
within the SQL database, the error message indicates that the
tblMySQLtableName1 object could not be found. To me, this indicates
that the source and destination are both recognized and the
TransferDatabase function is attempting (properly so) to create a new
table rather than overwriting or appending to an existing table, but it
stalls on the creation of the new table.

Question:

Does anyone have suggestions (read: example code) of what might be a
good way to either overcome the above problem or perhaps a better way
of accomplishing the same goal, keeping in mind that stored procedures
and most of the DTS functionality isn't available in MSDE?

Thanks in advance,

JBH

Nov 13 '05 #2

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

Similar topics

1
by: Hank Reed | last post by:
For about a year I have been printing pdf files from Access 2000 using the ShellExecute Me.hWnd, "print", FileName, "", 0, SW_SHOWNORMAL We normally print, from 1 to 100 engineering documents in...
7
by: nizar.jouini | last post by:
Hello. I have long text file whitch is formatted like this: nextrow4 asdf asdf
1
by: Toma | last post by:
Hello ! First, excuse me for my very bad English, but I'll try to explain my problem ..... I write my first Web Application on C# and ASP.NET /till now I write only for Windows/, and this WebApp...
22
by: Jordan S. | last post by:
SQL Server will be used as the back-end database to a non trivial client application. In question is the choice of client application: I need to be able to speak intelligently about when one...
2
by: denisel | last post by:
Hi, We will be conducting surveys through SurveyMonkey online and will be importing the answers by tab delimited or comma delimited file into access. I was wondering if there is specific way to...
0
by: ftech | last post by:
Hi, I have to upload files from a client folder to the server. The user may select any folder and the folder may contain any number of files. I provide the users with a text box to enter the...
1
by: rrrelic | last post by:
Can someone help me with this? I am running Access 2003 and attempting to import and append multiple XML files into Access. I currently do this process using the Import tool built into Access’s...
1
by: Wayne L | last post by:
I am having trouble importing certain .dbf files to access. I want them all to import into one file and then be deleted off the C:\ . I have tried to copy and rename the .dbf files to a text and...
3
by: HistoricVFP | last post by:
Hello, I’ve been given the task of importing .dbf files from a very old version of Visual FoxPro (version 2.1) into Access (2003). When I import the data straight to Access it errors with: ...
1
by: Adrian Scott | last post by:
Here are two sample file Header ID DATE AMT DESCRIPTION 02 11/1/11 25 This is my descrption Header ID DATE AMT DESCRIPTION
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: 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
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.