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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading CSV file using VBA-- specific rows and columns with datatypes

Status
Not open for further replies.

newpgm

Programmer
Jan 1, 2010
7
US
I need to read a csv file..
Sub import_csv()
DoCmd.TransferText acImportDelim, "", "Test_CSV", "c:\csv_files\12-31-2009
Test.csv", False, ""
End Sub
but my code is not successful, because one of my field some times has numbers values and other times it have character values so this field is not imported at all with my aboove code.

question 2
If my row 5 field1 has the value = A10,5770,test1,Undetermined, how can I
read them into different fields..

well=A10
sample=5770
dectect=test1
value=Undetermined

Thanks
 
First, why not create an import specification that can force the data types of your columns? Once you have the records imported, you can use some code or whatever to parse strings into separate fields or values.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top