473,396 Members | 1,918 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.

Importing multiple files..

Hello,
I have to import monthly, files that were once *.csv but due to commas in
addresses, the interface program was changed to dump tab delimited. Now my
code is not finding the files in the folder? The code is below - can anyone
help? (The files still are named with the extension of *.csv)
Function Import_Records()
'On Error GoTo Import_Records_Err

'Delete the all records in MONTHLY_IMPORTS table
'Call Delete_the_Monthly_Imports_Data

Dim db As DAO.Database
Dim strInputDir, strImportFile As String, strTableName As String
Dim strFileExt As String
Dim strSQL As String
Dim strSelectFdr As Module

'strSelectFdr = Select_Year
' the pathname of the folder that contains the files for import
strInputDir = "S:\Council\APPS\GENETICS\CURRENT\"

' the file extension for the type of files to import
strFileExt = ".csv"
' the destination table in the database
strTableName = "Genetics Imports"

strImportFile = Dir(strInputDir & "\*" & strFileExt)
Set db = CurrentDb

Do While Len(strImportFile) > 0
DoCmd.TransferText acImportDelim, "Genetics Import", strTableName,
strImportFile, False
strImportFile = Dir
Loop
' Beep
MsgBox "The Import has Completed", vbOKOnly, ""

--
Message posted via http://www.accessmonster.com
Feb 28 '06 #1
4 2188
Kathie via AccessMonster.com wrote:
Hello,
I have to import monthly, files that were once *.csv but due to commas in
addresses, the interface program was changed to dump tab delimited. Now my
code is not finding the files in the folder? The code is below - can anyone
help? (The files still are named with the extension of *.csv) <SNIP> ' the pathname of the folder that contains the files for import
strInputDir = "S:\Council\APPS\GENETICS\CURRENT\" <SNIP> strImportFile = Dir(strInputDir & "\*" & strFileExt)
Set db = CurrentDb

<SNIP>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The path name has 2 \ characters after the concatenation:

S:\Council\APPS\GENETICS\CURRENT\\*.csv

Change this:

strImportFile = Dir(strInputDir & "\*" & strFileExt)

to this:

strImportFile = Dir(strInputDir & "*" & strFileExt)

Or, change this:

strInputDir = "S:\Council\APPS\GENETICS\CURRENT\"

to this:

strInputDir = "S:\Council\APPS\GENETICS\CURRENT"

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

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

iQA/AwUBRAS2H4echKqOuFEgEQImAgCfeajWeKkITIIlQaRNHUysDl EQKqkAn0k+
zO36ktKiywydxsDUN5tzOSvh
=eTF2
-----END PGP SIGNATURE-----
Feb 28 '06 #2
Thanks for the response. Neither worked. The code was ok until the file
changed. The file changed (not the name) from a comma delimited to a tab
delimited. I tried even changing the extension to a *.txt and that did not
work. I have also changed the specifications in "Genetics Imports" and nodda.
... :(

MGFoster wrote:
Hello,
I have to import monthly, files that were once *.csv but due to commas in
addresses, the interface program was changed to dump tab delimited. Now my
code is not finding the files in the folder? The code is below - can anyone
help? (The files still are named with the extension of *.csv)

<SNIP>
' the pathname of the folder that contains the files for import
strInputDir = "S:\Council\APPS\GENETICS\CURRENT\"

<SNIP>
strImportFile = Dir(strInputDir & "\*" & strFileExt)
Set db = CurrentDb

<SNIP>

The path name has 2 \ characters after the concatenation:

S:\Council\APPS\GENETICS\CURRENT\\*.csv

Change this:

strImportFile = Dir(strInputDir & "\*" & strFileExt)

to this:

strImportFile = Dir(strInputDir & "*" & strFileExt)

Or, change this:

strInputDir = "S:\Council\APPS\GENETICS\CURRENT\"

to this:

strInputDir = "S:\Council\APPS\GENETICS\CURRENT"


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200602/1
Feb 28 '06 #3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Can you put a breakpoint after the line:

strImportFile = Dir(strInputDir & "\*" & strFileExt)

to see if the string strImportFile is correctly formatted? Try running
it in a Command window to see if it returns the files you want:

C:>dir S:\Council\APPS\GENETICS\CURRENT\*.csv

I don't believe this is a comma-separated vs. a tab-separated problem --
unless the .csv file has been opened by an Excel program and then saved
as an Excel file instead of a Text file. Can u open the .csv file using
Notepad? Does it look OK?

Have you changed the import specification to use Tab as the field
separator?
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

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

iQA/AwUBRAS8XIechKqOuFEgEQKlYwCeNtuTwmCu0rr5Cn4w27EJUc qcX9AAoKzO
Wdv1D03wUl9siNsu1sB7BpFv
=u4VT
-----END PGP SIGNATURE-----

kathie via AccessMonster.com wrote:
Thanks for the response. Neither worked. The code was ok until the file
changed. The file changed (not the name) from a comma delimited to a tab
delimited. I tried even changing the extension to a *.txt and that did not
work. I have also changed the specifications in "Genetics Imports" and nodda.
.. :(

MGFoster wrote:
Hello,
I have to import monthly, files that were once *.csv but due to commas in
addresses, the interface program was changed to dump tab delimited. Now my
code is not finding the files in the folder? The code is below - can anyone
help? (The files still are named with the extension of *.csv)


<SNIP>
' the pathname of the folder that contains the files for import
strInputDir = "S:\Council\APPS\GENETICS\CURRENT\"


<SNIP>
strImportFile = Dir(strInputDir & "\*" & strFileExt)
Set db = CurrentDb


<SNIP>

The path name has 2 \ characters after the concatenation:

S:\Council\APPS\GENETICS\CURRENT\\*.csv

Change this:

strImportFile = Dir(strInputDir & "\*" & strFileExt)

to this:

strImportFile = Dir(strInputDir & "*" & strFileExt)

Or, change this:

strInputDir = "S:\Council\APPS\GENETICS\CURRENT\"

to this:

strInputDir = "S:\Council\APPS\GENETICS\CURRENT"


Feb 28 '06 #4

Kathie via AccessMonster.com wrote:
Hello,
I have to import monthly, files that were once *.csv but due to commas in
addresses, the interface program was changed to dump tab delimited. Now my
code is not finding the files in the folder? The code is below - can anyone
help? (The files still are named with the extension of *.csv)
Function Import_Records()
'On Error GoTo Import_Records_Err

'Delete the all records in MONTHLY_IMPORTS table
'Call Delete_the_Monthly_Imports_Data

Dim db As DAO.Database
Dim strInputDir, strImportFile As String, strTableName As String
Dim strFileExt As String
Dim strSQL As String
Dim strSelectFdr As Module

'strSelectFdr = Select_Year
' the pathname of the folder that contains the files for import
strInputDir = "S:\Council\APPS\GENETICS\CURRENT\"

' the file extension for the type of files to import
strFileExt = ".csv"
' the destination table in the database
strTableName = "Genetics Imports"

strImportFile = Dir(strInputDir & "\*" & strFileExt)
Set db = CurrentDb

Do While Len(strImportFile) > 0
DoCmd.TransferText acImportDelim, "Genetics Import", strTableName,
strImportFile, False
strImportFile = Dir
Loop
' Beep
MsgBox "The Import has Completed", vbOKOnly, ""

--
Message posted via http://www.accessmonster.com


Just checking with you....

DoCmd.TransferText acImportDelim, "Genetics Import", strTableName,

Have you redefined this to transfer tab delimited data instead of comma
delimited data?

osmethod

Mar 1 '06 #5

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

Similar topics

2
by: steve | last post by:
Hi, I have researched but have not found a good solution to this problem. I am importing large amounts of data (over 50 Meg) into a new mysql db that I set up. I use >mysql dbname <...
4
by: Indra | last post by:
Hi There, I am looking for information on how to import the txt or csv file to the multiple table in sql 2000. If you have any kind of inf. please let me know wheather we can do this and how. ...
1
by: Steve George | last post by:
Hi, I have a scenario where I have a master schema that defines a number of complex and simple types. I then have a number of other schemas (with different namespaces) where I would like to reuse...
2
by: Regnab | last post by:
Just chasing a few ideas for a suitable loop for importing multiple text files. Up until now I have used a Do While Len(strfile) > 0 and moved each file to a different folder after being imported....
5
by: Mike Collins | last post by:
I am trying to export data from multiple tables in SQL Server to an XML file so I can then import it to another database. It seems to be working fine for exporting, but I am having trouble...
3
by: mukeshsrivastav | last post by:
dear sir i want to move form excel to access. i have 5 excel file having same formats and fields.now i want to import all data in one access table. importing one file is easy .but importing and...
4
by: JamesSykes | last post by:
Hi, I am relatively new to Access and VBA. I am trying to import a number of database files (just really want the contents of their tables) from a specified folder into a master table that...
28
by: kkadakia | last post by:
I get a daily excel file for a entire month which I want to transfer into Access at the end of the month. So, there are around 20-25 excel files I get by the end of the month, and I would like to...
7
by: cannunzi | last post by:
I'm trying to import multiple files in one access table all at once but i keep hitting an error stating incorrect file path. The code below works when i change the * to the exact file name but then...
2
by: ciaran.hudson | last post by:
Hi I have multiple excel files of the same format in a directory. They are called book1.xls, book2.xls, book3.xls and so on. What is the easiest way to import the tab named sheet1 from each of...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
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
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...
0
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...
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.