Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file in .csv.pgp.csv format

Status
Not open for further replies.

batteam

Programmer
Sep 12, 2003
374
US
I have a file in this format: xxxxxxx.csv.pgp.csv format and am trying to open it as a recordset with the following code:
Dim cnn As Connection
Set cnn = New Connection
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & varPath & ";" & _
"Extended Properties=""text;HDR=Yes;FMT=Delimited;"";"

Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "Select * from " & strSchema, cnn, , , adCmdText

This give me a file not found error. However I am able to open a file with just this format: xxxx.csv with no problems. Has anybody seen a .csv file with these added extensions and have any experience opening them up as an ADO recordset? My group is getting these files from another source and don't have control on the format they send them in.

Thanks for any advice you can provide.
 
The extension on a file name does not guarantee it is in any particular format. Extensions are conventions only. I could change the .doc extenstion of a Word file to ".bmp", that doesn't mean it's now a bitmap.

The only way you will truly know if it's a delimited file is to open up it - open it in Notepad and see what it looks like.

Joe Schwarz
Custom Software Developer
 
You may need to rename the files. Some programs get hung up on the name and make assumptions about the file that aren't correct. I've received files that are csv format, but if the files had a name like xyz.txt or xyz.20080503 or xyz.20080503.csv I couldn't import. The solution that worked for me was to rename the files. If the filename format is always the same xyz.csv.pgp.csv, then you could write code to change the file name to a more agreeable name like xyz_pgp.csv for example. If you aren't supposed to change the file name, then you would need to consider copying the file to a new name.
 
OK, thanks for the responses.

I will work on renaming them to what works. Makes the most sense to me. Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top