Import Help Please

H

hope

Hi All

Access 97


I just cannot get my head round this problem, so came back to the good old utter access for help

1...I have got a data base that I'm making for a karaoke song book.

2....I have a program that exports the songs out in a xxxx.csv format.

3....Now I have put code in like this

=============
Start of code
Option Compare Database
Option Explicit
---------------------------------------
' testimport
'------------------------------------------------------------
Function testimport()
On Error GoTo testimport_Err

DoCmd.TransferText acImportDelim, "", "AllTracks", "C:\import\AllTracks.csv", False, ""
testimport_Exit:
Exit Function
testimport_Err:
msgbox Error$
Resume testimport_Exit
End Function
End of code
========================================
Which works find upto a point.

The program that exports the xxx.csv file makes BLANK fields in it like this

song.......blank.......Artist......blank........label......blank......track......blank.......folder


So is there any way that I can do this?

1.....Take out the blanks befor inport ( I know I could inport into excel but that would be no good)

2......Make a delete query after inport into table that would look for blank fields and delete them.

3......Or any other way of getting rid of the blank fields.

Or am I going the wrong way to do this?


Object of thie data base is this

To make a song book of all my karaoke files . I know I can get programs that do this BUT I want it
for this karaoke program that I have got.

1....Once the program as made a data base of the songs I can export it as a xxx.csv file

2....Import that file into my access data base.

3....If the table as got data in it then it would delete that data and put in the new data.
(the reason for this is that the karaoke program makes a NEW export file every time with ALL new songs.

4.....I then can make a report for printing out a song book for the singers.


Hope I have made my self clear on all of this.


BTW if you know of anyone who as done this in Access Please could you let me know


Many thanks for your time

As always, any and all help is greatly appreciated.

Thank you in advance.

John
 
K

Ken Snell

Have you tried using an Import Specification? That will allow you to tell
ACCESS the fields to import, the format of the fields, etc. You set one up
by starting the import process manually, then clicking the Advanced button
(lower left corner of the import wizard window) to set all the parameters,
and then you save those parameters under some name.

Then, use that name as the argument for Specification in the TransferText
command.

--
Ken Snell
<MS ACCESS MVP>

Hi All

Access 97


I just cannot get my head round this problem, so came back to the good old utter access for help

1...I have got a data base that I'm making for a karaoke song book.

2....I have a program that exports the songs out in a xxxx.csv format.

3....Now I have put code in like this

=============
Start of code
Option Compare Database
Option Explicit
---------------------------------------
' testimport
'------------------------------------------------------------
Function testimport()
On Error GoTo testimport_Err

DoCmd.TransferText acImportDelim, "", "AllTracks",
"C:\import\AllTracks.csv", False, ""
 
H

hope

Hi Ken

Thank you for your help

You have lost me

Ok in my data base do I click on the tables icon then right mouse
click for import?
If so I do not see a Advance button lower left, it is on the right
under cancel
========================================

I think this would be no good as the blank fields can change.

So one time it could be field 1 the next time it could be field 2

What I want is some thing like

"look for any blank fields then delete them" from the table


regards

John
 
K

Ken Snell

A nonstandard output file is what you must deal with? That can complicate
things quite a bit.

First, to address the initial suggestion. What you'd do is to click File |
Get External Data ... | Import and go through the manual steps for importing
a file. At the wizard window, you'll see the advanced button.

But, to continue with your new info....

With the changing file contents structure in the .csv file, how do you know
which field is which value? Is the order always the same, and just that
there can be one (or more?) blank fields at the beginning and inbetween the
fields? Does the .csv file contain the filenames as the first record in the
file?

Post some actual examples of the first five records from different files so
that we can see the variations.
 
H

hope

Hi Ken

Thank you VERY much for your time with me, very nice of you.

Please see below comments

================

A nonstandard output file is what you must deal with? That can complicate
things quite a bit.

Yes this is what I have found out :))
======================================
First, to address the initial suggestion. What you'd do is to click File |
Get External Data ... | Import and go through the manual steps for importing
a file. At the wizard window, you'll see the advanced button.

Found it know, oh so dum me.
Yes I can do that and deselect any of the fields BUT that is just going to take so long to do all the time.
======================================================
But, to continue with your new info....

With the changing file contents structure in the .csv file, how do you know
which field is which value?

That depends on the program how it exports the file in the first place.

You can set up the export as

disk....track......artist......title........
disk....track......title.......artist
title.....artist....
artist...title
title....artist.....disk.....track
artist....title......disk....track
all in one...
disk no track.....title......artist
disk no track....artist.....title

So you see it could be any of the above combi

Having said that most of the songs take a format of
disk....track......title.......artist
===============================================
Is the order always the same, and just that
there can be one (or more?) blank fields at the beginning and inbetween the
fields? Does the .csv file contain the filenames as the first record in the
file?

Post some actual examples of the first five records from different files so
that we can see the variations.

Ken can I email you direct?

I can then send you some samples of the csv files also the program so you can see what goes on.

I do not know if I can post attachments to this news group

MY EMAIL IS (e-mail address removed)

If not I will understand you and post to this group and hope I do not get banned.


Once again Ken thank you very much for your time.


Regards

John

===================================================
 
K

Ken Snell

Just paste some example records into a reply post so that we can see them.
Attachments are not desired in this newsgroup, and I don't believe we've
reached a point where I need to see the data etc. directly.


--
Ken Snell
<MS ACCESS MVP>

Hi Ken

Thank you VERY much for your time with me, very nice of you.

Please see below comments

================

Yes this is what I have found out :))
======================================


Found it know, oh so dum me.
Yes I can do that and deselect any of the fields BUT that is just going to
take so long to do all the time.
 
H

hope

Hi Ken

Ok here you go

csv file 1
=========================
"",,"ABBA - NAME OF THE GAME ABBA",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\ABBA - NAME OF THE GAME ABBA.ZIP"
"",,"ABBA - TAKE A CHANCE ON ME ABBA",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\ABBA - TAKE A CHANCE ON ME ABBA.ZIP"
"MICHAEL, GEORGE1",,"CARELESS WHISPER",,"BL07",,"05",,"C:\KARAKOKE
SONGS\ZIP TEST\BL07-05 - CARELESS WHISPER - MICHAEL, GEORGE1.ZIP"
"HOUSTON, WHITNEY",,"SAVING ALL MY LOVE FOR
YOU",,"BL07",,"09",,"C:\KARAKOKE SONGS\ZIP TEST\BL07-09 - SAVING ALL
MY LOVE FOR YOU - HOUSTON, WHITNEY.ZIP"
"MCFERRIN, BOBBY",,"DON'T WORRY BE HAPPY",,"BL07",,"13",,"C:\KARAKOKE
SONGS\ZIP TEST\BL07-13 - DON'T WORRY BE HAPPY - MCFERRIN, BOBBY.ZIP"
"IF YOU REALLY LOVE ME",,"WONDER, STEVIE",,"DG04",,"11",,"C:\KARAKOKE
SONGS\ZIP TEST\DG04-11 - WONDER, STEVIE - IF YOU REALLY LOVE ME.ZIP"
"BECAUSE YOU LOVED ME1",,"DION, CELINE",,"DGH01",,"03",,"C:\KARAKOKE
SONGS\ZIP TEST\DGH01-03 - DION, CELINE - BECAUSE YOU LOVED ME1.ZIP"
"",,"DK004-15 EASTON, SHEENA - MORNING TRAIN (NINE TO
FIVE)1",,"",,"",,"C:\KARAKOKE SONGS\ZIP TEST\DK004-15 EASTON, SHEENA -
MORNING TRAIN (NINE TO FIVE)1.ZIP"
"",,"DK033-14 EVERLY BROTHERS, THE - ALL I HAVE TO DO IS
DREAM1",,"",,"",,"C:\KARAKOKE SONGS\ZIP TEST\DK033-14 EVERLY BROTHERS,
THE - ALL I HAVE TO DO IS DREAM1.ZIP"
"I WANNA DANCE WITH SOMEBODY (WHO LOVES ME)",,"HOUSTON,
WHITNEY",,"EK016",,"07",,"C:\KARAKOKE SONGS\ZIP TEST\EK016-07 -
HOUSTON, WHITNEY - I WANNA DANCE WITH SOMEBODY (WHO LOVES ME).ZIP"
============================================
csv file two
"ABBA",,"KNOWING ME KNOWING YOU",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\ABBA - KNOWING ME KNOWING YOU.ZIP"
"ABBA",,"NAME OF THE GAME ABBA",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\ABBA - NAME OF THE GAME ABBA.ZIP"
"ABBA",,"TAKE A CHANCE ON ME ABBA",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\ABBA - TAKE A CHANCE ON ME ABBA.ZIP"
"BL07-05",,"CARELESS WHISPER",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\BL07-05 - CARELESS WHISPER - MICHAEL, GEORGE1.ZIP"
"BL07-07",,"HOLIDAY",,"",,"",,"C:\KARAKOKE SONGS\ZIP TEST\BL07-07 -
HOLIDAY - MADONNA.ZIP"
"BL07-09",,"SAVING ALL MY LOVE FOR YOU",,"",,"",,"C:\KARAKOKE
SONGS\ZIP TEST\BL07-09 - SAVING ALL MY LOVE FOR YOU - HOUSTON,
WHITNEY.ZIP"
"BL07-13",,"DON'T WORRY BE HAPPY",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\BL07-13 - DON'T WORRY BE HAPPY - MCFERRIN, BOBBY.ZIP"
"CBE1-04-14",,"TWITTY CONWAY",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\CBE1-04-14 - TWITTY CONWAY - IT S ONLY MAKE BELIEVE.ZIP"
"DG04-11",,"WONDER, STEVIE",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\DG04-11 - WONDER, STEVIE - IF YOU REALLY LOVE ME.ZIP"
"DGH01-03",,"DION, CELINE",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\DGH01-03 - DION, CELINE - BECAUSE YOU LOVED ME1.ZIP"
"DK004-15 EASTON, SHEENA",,"MORNING TRAIN (NINE TO
FIVE)1",,"",,"",,"C:\KARAKOKE SONGS\ZIP TEST\DK004-15 EASTON, SHEENA -
MORNING TRAIN (NINE TO FIVE)1.ZIP"
"DK007-16 ORBISON, ROY",,"ONLY THE LONELY1",,"",,"",,"C:\KARAKOKE
SONGS\ZIP TEST\DK007-16 ORBISON, ROY - ONLY THE LONELY1.ZIP"
"DK033-14 EVERLY BROTHERS, THE",,"ALL I HAVE TO DO IS
DREAM1",,"",,"",,"C:\KARAKOKE SONGS\ZIP TEST\DK033-14 EVERLY BROTHERS,
THE - ALL I HAVE TO DO IS DREAM1.ZIP"
"EK016-07",,"HOUSTON, WHITNEY",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\EK016-07 - HOUSTON, WHITNEY - I WANNA DANCE WITH SOMEBODY (WHO
LOVES ME).ZIP"
"EK016-10",,"DEE, KIKI",,"",,"",,"C:\KARAKOKE SONGS\ZIP TEST\EK016-10
- DEE, KIKI - I'VE GOT THE MUSIC IN ME.ZIP"
"EK016-14",,"CARPENTERS, THE",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\EK016-14 - CARPENTERS, THE - TOP OF THE WORLD.ZIP"
"EK016-15",,"HOUSTON, WHITNEY",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\EK016-15 - HOUSTON, WHITNEY - GREATEST LOVE OF ALL, THE.ZIP"
"EK016-17",,"DION, CELINE",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\EK016-17 - DION, CELINE - POWER OF LOVE.ZIP"
"EKF14-06",,"SATURDAY NIGHT",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\EKF14-06 - SATURDAY NIGHT - WHIGFIELD.ZIP"
"PHM9703-01",,"WALLFLOWERS, THE",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\PHM9703-01 - WALLFLOWERS, THE - ONE HEADLIGHT.ZIP"
"PHM9703-02",,"DION, CELINE",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\PHM9703-02 - DION, CELINE - ALL BY MYSELF.ZIP"
==============================

Ok that is just two ways it would export the file


Thank you

John



Just paste some example records into a reply post so that we can see them.
Attachments are not desired in this newsgroup, and I don't believe we've
reached a point where I need to see the data etc. directly.
 
K

Ken Snell

One big problem that I see is the inability of the file to tell you what the
fields are and in what order they are.

Unless you can standardize the file content format, or somehow know what the
file's contents are going to be, it's going to be extermely difficult to set
up an automatic process for all possibilities of the file's contents.

Are you not able to settle on a single file output and then we can let
ACCESS manipulate the data as you desire?
--
Ken Snell
<MS ACCESS MVP>



Hi Ken

Ok here you go

csv file 1
=========================
"",,"ABBA - NAME OF THE GAME ABBA",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\ABBA - NAME OF THE GAME ABBA.ZIP"
"",,"ABBA - TAKE A CHANCE ON ME ABBA",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\ABBA - TAKE A CHANCE ON ME ABBA.ZIP"
"MICHAEL, GEORGE1",,"CARELESS WHISPER",,"BL07",,"05",,"C:\KARAKOKE
SONGS\ZIP TEST\BL07-05 - CARELESS WHISPER - MICHAEL, GEORGE1.ZIP"
"HOUSTON, WHITNEY",,"SAVING ALL MY LOVE FOR
YOU",,"BL07",,"09",,"C:\KARAKOKE SONGS\ZIP TEST\BL07-09 - SAVING ALL
MY LOVE FOR YOU - HOUSTON, WHITNEY.ZIP"
"MCFERRIN, BOBBY",,"DON'T WORRY BE HAPPY",,"BL07",,"13",,"C:\KARAKOKE
SONGS\ZIP TEST\BL07-13 - DON'T WORRY BE HAPPY - MCFERRIN, BOBBY.ZIP"
"IF YOU REALLY LOVE ME",,"WONDER, STEVIE",,"DG04",,"11",,"C:\KARAKOKE
SONGS\ZIP TEST\DG04-11 - WONDER, STEVIE - IF YOU REALLY LOVE ME.ZIP"
"BECAUSE YOU LOVED ME1",,"DION, CELINE",,"DGH01",,"03",,"C:\KARAKOKE
SONGS\ZIP TEST\DGH01-03 - DION, CELINE - BECAUSE YOU LOVED ME1.ZIP"
"",,"DK004-15 EASTON, SHEENA - MORNING TRAIN (NINE TO
FIVE)1",,"",,"",,"C:\KARAKOKE SONGS\ZIP TEST\DK004-15 EASTON, SHEENA -
MORNING TRAIN (NINE TO FIVE)1.ZIP"
"",,"DK033-14 EVERLY BROTHERS, THE - ALL I HAVE TO DO IS
DREAM1",,"",,"",,"C:\KARAKOKE SONGS\ZIP TEST\DK033-14 EVERLY BROTHERS,
THE - ALL I HAVE TO DO IS DREAM1.ZIP"
"I WANNA DANCE WITH SOMEBODY (WHO LOVES ME)",,"HOUSTON,
WHITNEY",,"EK016",,"07",,"C:\KARAKOKE SONGS\ZIP TEST\EK016-07 -
HOUSTON, WHITNEY - I WANNA DANCE WITH SOMEBODY (WHO LOVES ME).ZIP"
============================================
csv file two
"ABBA",,"KNOWING ME KNOWING YOU",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\ABBA - KNOWING ME KNOWING YOU.ZIP"
"ABBA",,"NAME OF THE GAME ABBA",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\ABBA - NAME OF THE GAME ABBA.ZIP"
"ABBA",,"TAKE A CHANCE ON ME ABBA",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\ABBA - TAKE A CHANCE ON ME ABBA.ZIP"
"BL07-05",,"CARELESS WHISPER",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\BL07-05 - CARELESS WHISPER - MICHAEL, GEORGE1.ZIP"
"BL07-07",,"HOLIDAY",,"",,"",,"C:\KARAKOKE SONGS\ZIP TEST\BL07-07 -
HOLIDAY - MADONNA.ZIP"
"BL07-09",,"SAVING ALL MY LOVE FOR YOU",,"",,"",,"C:\KARAKOKE
SONGS\ZIP TEST\BL07-09 - SAVING ALL MY LOVE FOR YOU - HOUSTON,
WHITNEY.ZIP"
"BL07-13",,"DON'T WORRY BE HAPPY",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\BL07-13 - DON'T WORRY BE HAPPY - MCFERRIN, BOBBY.ZIP"
"CBE1-04-14",,"TWITTY CONWAY",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\CBE1-04-14 - TWITTY CONWAY - IT S ONLY MAKE BELIEVE.ZIP"
"DG04-11",,"WONDER, STEVIE",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\DG04-11 - WONDER, STEVIE - IF YOU REALLY LOVE ME.ZIP"
"DGH01-03",,"DION, CELINE",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\DGH01-03 - DION, CELINE - BECAUSE YOU LOVED ME1.ZIP"
"DK004-15 EASTON, SHEENA",,"MORNING TRAIN (NINE TO
FIVE)1",,"",,"",,"C:\KARAKOKE SONGS\ZIP TEST\DK004-15 EASTON, SHEENA -
MORNING TRAIN (NINE TO FIVE)1.ZIP"
"DK007-16 ORBISON, ROY",,"ONLY THE LONELY1",,"",,"",,"C:\KARAKOKE
SONGS\ZIP TEST\DK007-16 ORBISON, ROY - ONLY THE LONELY1.ZIP"
"DK033-14 EVERLY BROTHERS, THE",,"ALL I HAVE TO DO IS
DREAM1",,"",,"",,"C:\KARAKOKE SONGS\ZIP TEST\DK033-14 EVERLY BROTHERS,
THE - ALL I HAVE TO DO IS DREAM1.ZIP"
"EK016-07",,"HOUSTON, WHITNEY",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\EK016-07 - HOUSTON, WHITNEY - I WANNA DANCE WITH SOMEBODY (WHO
LOVES ME).ZIP"
"EK016-10",,"DEE, KIKI",,"",,"",,"C:\KARAKOKE SONGS\ZIP TEST\EK016-10
- DEE, KIKI - I'VE GOT THE MUSIC IN ME.ZIP"
"EK016-14",,"CARPENTERS, THE",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\EK016-14 - CARPENTERS, THE - TOP OF THE WORLD.ZIP"
"EK016-15",,"HOUSTON, WHITNEY",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\EK016-15 - HOUSTON, WHITNEY - GREATEST LOVE OF ALL, THE.ZIP"
"EK016-17",,"DION, CELINE",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\EK016-17 - DION, CELINE - POWER OF LOVE.ZIP"
"EKF14-06",,"SATURDAY NIGHT",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\EKF14-06 - SATURDAY NIGHT - WHIGFIELD.ZIP"
"PHM9703-01",,"WALLFLOWERS, THE",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\PHM9703-01 - WALLFLOWERS, THE - ONE HEADLIGHT.ZIP"
"PHM9703-02",,"DION, CELINE",,"",,"",,"C:\KARAKOKE SONGS\ZIP
TEST\PHM9703-02 - DION, CELINE - ALL BY MYSELF.ZIP"
==============================

Ok that is just two ways it would export the file


Thank you

John
 
H

hope

Hi Ken

Ok I have done some things to the export file now and I can make it
export in this format.


It will read
disk....track......title.......artist

SO the export file will be like this

=================================================
"MICHAEL, GEORGE1",,"CARELESS WHISPER",,"BL07",,"05",,"C:\KARAKOKE
SONGS\ZIP TEST\BL07-05 - CARELESS WHISPER - MICHAEL, GEORGE1.ZIP"
"HOUSTON, WHITNEY",,"GREATEST LOVE OF ALL",,"DISK
1",,"TRACK",,"C:\KARAKOKE SONGS\ZIP TEST\DISK 1-TRACK - GREATEST LOVE
OF ALL - HOUSTON, WHITNEY .ZIP"
"HOUSTON, WHITNEY",,"TITLE",,"DISK",,"TRACK",,"C:\KARAKOKE SONGS\ZIP
TEST\DISK-TRACK - TITLE - HOUSTON, WHITNEY.ZIP"
"WHITE SPORTS COAT",,"KING BROTHERS",,"SF063",,"01",,"C:\KARAKOKE
SONGS\ZIP TEST\SF063-01 - KING BROTHERS - WHITE SPORTS COAT.ZIP"
====================================
Now if you look at it in excell you will see that col's B,D,F,H are
blank

IE Field 2,4,6,8

This should be the standard format from the export file now

So if you can sort out how to delete those fields/col's that would be
great.


Thank you

John
 
K

Ken Snell

OK - this is good!

Here is what I suggest:

(1) create an Import Specification that will skip the second, fourth, sixth,
and eighth fields and that will use field names of your choosing (do this by
starting a manual import, click "Advanced" button in the Wizard window, set
the information in that specification, save it under some name of your
choosing) -- after doing this, cancel the rest of the import;

(2) create a table to receive the imported data -- be sure that the field
names in the table match those in your Import Specification and that the
fields' formats match those in the specification;

(3) import the table using TransferText command, being sure to include the
specification name as the second argument for the command.

You should now get the desired results without the "empty" fields.
 
H

hope

Hi Ken

Thank you very much for all your trouble with me

Also thank you for the very detailed information below

Comments:

(1)
(1) create an Import Specification that will skip the second, fourth, sixth,
and eighth fields and that will use field names of your choosing (do this by
starting a manual import, click "Advanced" button in the Wizard window, set
the information in that specification, save it under some name of your
choosing) -- after doing this, cancel the rest of the import;

Yes worked just fine

========================================
(2)
(2) create a table to receive the imported data -- be sure that the field
names in the table match those in your Import Specification and that the
fields' formats match those in the specification;

Yes all ok BUT I had to leave out fields 2... 4.... 6...8 in the table, yes the import did skip the 2 4 6 8 BUT it looks like to me that it would only
skip the data in the fields and NOT leave out the field.
So if I made my table with out these fields it all worked fine.

=========================================================
BTW
This as sorted out another problem that I had.
The export file would not export the headers with the file
BUT now you have given me that way of import I can alter the import file fields and put the headers in and then save it
All the time I have used Access I NEVER did know that save option was there. THANK YOU.

Well Ken that is about it, I think I have now just about got it right.
================================================
(3) import the table using TransferText command, being sure to include the
specification name as the second argument for the command.

On the above.
In the line of code where it says

=========================================================
DoCmd.TransferText acImportDelim, "AllTracks Import Specification", "headerstest", "C:\kaoake programs\Sax & Dottys Show Hoster\AllTracks.csv", False, ""
=======================================================
I have been trying to put in a prompt command to ask where the file is.
Like "please put in the path to the csv file".
this then would replace what ever is in the path statement.


Anyway many thanks for all your time.


regards

John
 
K

Ken Snell

Glad to learn of your progress. Sorry that my post wasn't clear...I intended
that you should NOT include in the table the fields that you didn't plan to
import.

Easiest way to get the path to a file is to use the InputBox function to ask
the user (you?) to enter the entire path:

DoCmd.TransferText acImportDelim, "AllTracks Import Specification",
"headerstest", InputBox("Provide the path to the file:", "Path To File"),
False, ""


You can specify a default "value" with the InputBox that may shorten the
typing that you would need to do (third argument in the list):

DoCmd.TransferText acImportDelim, "AllTracks Import Specification",
"headerstest", InputBox("Provide the path to the file:", "Path To File",
"C:\kaoake programs\Sax & Dottys Show Hoster\AllTracks.csv") , False, ""


Alternatively, you can use the "OpenFile" dialog box from Windows to
navigate to the file (instead of the InputBox). The code for doing this is
more complex, but is available at The ACCESS Web:
http://www.mvps.org/access/api/api0001.htm

Good luck.

Hi Ken

Thank you very much for all your trouble with me

Also thank you for the very detailed information below

Comments:

(1)

Yes worked just fine

========================================
(2)


Yes all ok BUT I had to leave out fields 2... 4.... 6...8 in the
table, yes the import did skip the 2 4 6 8 BUT it looks like to me that it
would only
skip the data in the fields and NOT leave out the field.
So if I made my table with out these fields it all worked fine.

=========================================================
BTW
This as sorted out another problem that I had.
The export file would not export the headers with the file
BUT now you have given me that way of import I can alter the import file
fields and put the headers in and then save it
All the time I have used Access I NEVER did know that save option was there. THANK YOU.

Well Ken that is about it, I think I have now just about got it right.
================================================

On the above.
In the line of code where it says

=========================================================
DoCmd.TransferText acImportDelim, "AllTracks Import Specification",
"headerstest", "C:\kaoake programs\Sax & Dottys Show Hoster\AllTracks.csv",
False, ""
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top