A
Akeel Ahmed
Hi Guys,
I have a csv file that conatins the following:
Case Number,Subject,Project Predecessors
3808,Data Migration:,
4011,Production,Campaigns and opportunities,3808
4012,Campaigns and opportunities,4011-3808
I have a macro in project that uses ADO to load up the csv file : the code
is as follows:
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordset = CreateObject("ADODB.Recordset")
strPathtoTextFile = "C:\"
objConnection.Open "Driver={Microsoft Text Driver (*.txt; *.csv)};" & _
"Dbq=" & strPathtoTextFile & ";" & _
"Extensions=asc,csv,tab,txt;"
objRecordset.Open "SELECT * FROM [IO Project Report.csv]", _
objConnection, adOpenStatic, adLockOptimistic, adCmdText
I then loop through the records in the recordset and create tasks, assign
resources and set up dependencies.
The issue I am facing is that for the third line item in the CSV where we
have the predessor column with a value of 4011-3808, the ADO recordset does
not return any value (its fine for the previous line item) - I would expect
to see the value 4011-3808 but its empty, I am completely baffled. i have
tried to move the lineitems around but everytime I have a dual keyed item
(i.e. nt a single number like 3808) the recordset returns empty. I am using
a standard statement to retriev the data from the recordset (which wirks fine
for all other items).
Has anyone any idea what I may be doing wrong or what I may not be setting?
I will keep hunting and if I come across a solutiuon I will be sure to post
it up (ps I have tried using a different connection:
objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPathtoTextFile & ";" & _
"Extended Properties=""text;HDR=YES;FMT=CSVDelimited"""
but still no joy.
Thanks in advance for your help.
Akeel
I have a csv file that conatins the following:
Case Number,Subject,Project Predecessors
3808,Data Migration:,
4011,Production,Campaigns and opportunities,3808
4012,Campaigns and opportunities,4011-3808
I have a macro in project that uses ADO to load up the csv file : the code
is as follows:
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordset = CreateObject("ADODB.Recordset")
strPathtoTextFile = "C:\"
objConnection.Open "Driver={Microsoft Text Driver (*.txt; *.csv)};" & _
"Dbq=" & strPathtoTextFile & ";" & _
"Extensions=asc,csv,tab,txt;"
objRecordset.Open "SELECT * FROM [IO Project Report.csv]", _
objConnection, adOpenStatic, adLockOptimistic, adCmdText
I then loop through the records in the recordset and create tasks, assign
resources and set up dependencies.
The issue I am facing is that for the third line item in the CSV where we
have the predessor column with a value of 4011-3808, the ADO recordset does
not return any value (its fine for the previous line item) - I would expect
to see the value 4011-3808 but its empty, I am completely baffled. i have
tried to move the lineitems around but everytime I have a dual keyed item
(i.e. nt a single number like 3808) the recordset returns empty. I am using
a standard statement to retriev the data from the recordset (which wirks fine
for all other items).
Has anyone any idea what I may be doing wrong or what I may not be setting?
I will keep hunting and if I come across a solutiuon I will be sure to post
it up (ps I have tried using a different connection:
objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPathtoTextFile & ";" & _
"Extended Properties=""text;HDR=YES;FMT=CSVDelimited"""
but still no joy.
Thanks in advance for your help.
Akeel