Sorry I guess I was not able ask my doubt properly.
Actually I meant; i was able to implement it with my need for files having header.
But now what should I be doing when the user input non header file; how will my schema.ini file look ex:
if the first one was like this
Code:
FileNum = FreeFile(0)
Open DataPath & "\schema.ini" For Output As #FileNum
Print #FileNum, "["; fileName; "]"
Print #FileNum, "Format=CSVDelimited"
Print #FileNum, "TextDelimiter=none"
Print #FileNum, "ColNameHeader="; NameHeader
Print #FileNum, "CharacterSet=ANSI"
Print #FileNum, "MaxScanRows=1" '0 means scan all rows, a waste of time for us.
Print #FileNum, "Col1=""BNFAC"" Text"
Print #FileNum, "Col2=BNFName"" Text"
Print #FileNum, "Col3=Amount"" Double"
Print #FileNum, "Col4=""Code"" Text"
Print #FileNum, "Col5=""OrdCustAC"" Text"
Print #FileNum, "Col6=""OrdCustName"" Text"
Print #FileNum, "Col7=""Description"" Text"
Close #FileNum
then will the No Header be like this ?
Code:
FileNum = FreeFile(0)
Open DataPath & "\schema.ini" For Output As #FileNum
Print #FileNum, "["; fileName; "]"
Print #FileNum, "Format=CSVDelimited"
Print #FileNum, "TextDelimiter=none"
Print #FileNum, "ColNameHeader="; NameHeader
Print #FileNum, "CharacterSet=ANSI"
Print #FileNum, "MaxScanRows=1" '0 means scan all rows, a waste of time for us.
Close #FileNum
if so, then how we write this statement without knowing the columns?
Code:
.Open "SELECT [4 Letters], [Some Code], Country, Edition, " _
& "Format$([Sold Count], '#') AS [Sold Count] FROM [" & FileName & "]", _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" _
& DataPath _
& "';Extended Properties='Text'", _
adOpenStatic, adLockReadOnly, adCmdText
and also how does JET will know which columns have text data so not to return NULL in case of data mismatch?