HAving problems opening recordset (1 Viewer)

jpl458

Well-known member
Local time
Today, 01:27
Joined
Mar 30, 2012
Messages
1,038
My first time trying this. here is the code I am using:

Code:
 Dim rsCLog As ADODB.RecordsetSet
   Set rsCLog = New ADODB.Recordset
   rsCLog.Source = "CLog"
   rsCLog.Open
   
       Do Until rs.EOF
      
       DoCmd.TransferText acImportDelim, , "LogExpanded", "C:\Users\jplor\OneDrive\Documents\RoboData\CCalls"", True"
        rs.MoveNext
   Loop
rsCLog.Close
Set rsCLog = Nothing

I keep getting this error on the first statement

1677268173821.png


CLog is a table in access that contains about 400 CSV files.

Any help would reduce my frustration level, and my need for too much chocolate.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:27
Joined
Feb 19, 2002
Messages
43,302
Did you set a reference to ADO?
What do you expect the loop to do? The TransferText is invalid and it also doesn't change each time the loop executes.

We spoke about this in a different thread where you said you had DATA from all the .csv files already in a table and now you wanted to transfer the DATA in that table to the permanent table. Did you mean you had loaded the names of the files into a table? And now you want to run a second loop to append the data? Pretty silly. You should append the data in the loop that reads the the directory. You don't need an ADO or even DAO loop for anything. All you need to do is to use the TransferText as you were instructed to do WITH a code sample, I might add. If you didn't understand that example, you should close this thread and go back to the other thread and ask for clarification there.

Creating multiple threads on the same topic is the fastest way I know to get people to stop trying to help you.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:27
Joined
Oct 29, 2018
Messages
21,477
Dim rsCLog As ADODB.RecordsetSet
Looks like a typo there. Should just be "Recordset."
 

June7

AWF VIP
Local time
Today, 00:27
Joined
Mar 9, 2014
Messages
5,475
AFAIK, ADODB recordset needs connection object. Simplify and use DAO recordset.

Doubled quotes at end of file path are not valid nor is the quote after True.

Why is recordset needed? Code is not using its data within loop. Code will just repeatedly import the same data. Or it would if there were a filename in the path. Since there is no extension shown, there is no filename. I expect need to concatenate a field name to pull filename from recordset.

"C:\Users\jplor\OneDrive\Documents\RoboData\CCalls\" & rsClog!MyFieldNameHere
 
Last edited:

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:27
Joined
Feb 19, 2002
Messages
43,302
For some reason I can't fathom, the OP thinks he needs an ADO recordset. But no one actually knows what problem we are trying to solve. Only that his code doesn't work. And now with this additional post, confusion will surely reign.
 

ebs17

Well-known member
Local time
Today, 10:27
Joined
Feb 7, 2020
Messages
1,949
@jpl458: Do you follow your own questions, or is it enough for you to keep yourself and others busy?
Import.csv file to the access table using VBA
If the RecordsetSet without duplicate set then works, it has no connection to TransferText after all. How can you just clump some code together so incoherently?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:27
Joined
Feb 19, 2002
Messages
43,302
@jpl458 This isn't FB. You don't need to "like" our posts. We are adults here and we "like" to use our words. We don't measure our worth by how many people "like" our posts. Like has no meaning in this context.

You've been told multiple times that you don't need a recordset - ADO or otherwise to import these .csv files. You've also been given code that will import all 200 of the files into a single table. Did you ever try it? Why ae we in a new thread?
 

jpl458

Well-known member
Local time
Today, 01:27
Joined
Mar 30, 2012
Messages
1,038
Did you set a reference to ADO?
What do you expect the loop to do? The TransferText is invalid and it also doesn't change each time the loop executes.

We spoke about this in a different thread where you said you had DATA from all the .csv files already in a table and now you wanted to transfer the DATA in that table to the permanent table. Did you mean you had loaded the names of the files into a table? And now you want to run a second loop to append the data? Pretty silly. You should append the data in the loop that reads the the directory. You don't need an ADO or even DAO loop for anything. All you need to do is to use the TransferText as you were instructed to do WITH a code sample, I might add. If you didn't understand that example, you should close this thread and go back to the other thread and ask for clarification there.

Creating multiple threads on the same topic is the fastest way I know to get people to stop trying to help you.

@jpl458 This isn't FB. You don't need to "like" our posts. We are adults here and we "like" to use our words. We don't measure our worth by how many people "like" our posts. Like has no meaning in this context.

You've been told multiple times that you don't need a recordset - ADO or otherwise to import these .csv files. You've also been given code that will import all 200 of the files into a single table. Did you ever try it? Why ae we in a new thread?

What's a RecordsetSet?
A typo
 

jpl458

Well-known member
Local time
Today, 01:27
Joined
Mar 30, 2012
Messages
1,038
@jpl458: Do you follow your own questions, or is it enough for you to keep yourself and others busy?
Import.csv file to the access table using VBA
If the RecordsetSet without duplicate set then works, it has no connection to TransferText after all. How can you just clump some code together so incoherently?
I apologize, I don't want to waste anyone's time. I am trying the solution you posted. Thank you for that.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:27
Joined
Feb 19, 2002
Messages
43,302
I posted an actual working example of an FSO loop for you to see in this thread:


The sample also does some more sophisticated processing such as creating a log table to help to prevent you from importing the same file multiple times.

Please mark one of them as closed and stick with the other.
 

jpl458

Well-known member
Local time
Today, 01:27
Joined
Mar 30, 2012
Messages
1,038
I posted an actual working example of an FSO loop for you to see in this thread:


The sample also does some more sophisticated processing such as creating a log table to help to prevent you from importing the same file multiple times.

Please mark one of them as closed and stick with the other.
Do you mean pick one and stick to it?

I saw the examples in the other post. I sent most of this reading, but it never sinks in till you do it, and examples of meaningful code are great.

Thanks again.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:27
Joined
Feb 19, 2002
Messages
43,302
Do you mean pick one and stick to it?
Having multiple threads open on the same topic is the fastest way to get you ignored by experts that I know of since you are just wasting people's time. When you don't value the time of the people helping you, they stop helping.
 

Users who are viewing this thread

Top Bottom