replace characters based on specified position number (2 Viewers)

anski

Registered User.
Local time
Today, 19:53
Joined
Sep 5, 2009
Messages
93
To clarify: why is it that if I use the code with the DUMMY replacement, Access goes through ALL the rows? Access replaces all the DUMMY texts in ALL the rows.

If I use the code with left, mid, right functions (it is essentially the same replacement function code but with the additional left, mid, right functions), Access just changes the last row.
 

isladogs

MVP / VIP
Local time
Today, 12:53
Joined
Jan 14, 2017
Messages
18,247
To clarify: why is it that if I use the code with the DUMMY replacement, Access goes through ALL the rows? Access replaces all the DUMMY texts in ALL the rows.

If I use the code with left, mid, right functions (it is essentially the same replacement function code but with the additional left, mid, right functions), Access just changes the last row.

The csv file is just one long text string.
When opened in Excel or Access, these read it using line feeds to show separate rows

The Replace function just looks for all instances of DUMMY and replaces them.
The Left, Mid and Right functions find specific positions in the string to allow you to read or modify that part of the string.

In this example there seems to be no benefit in using anything other than REPLACE
 

anski

Registered User.
Local time
Today, 19:53
Joined
Sep 5, 2009
Messages
93
^Good explanation (specially: "The csv file is just one long text string. ")

Is it still possible for me to go through each row in the text file to run the Replace function with left and mid functions?
 

jdraw

Super Moderator
Staff member
Local time
Today, 07:53
Joined
Jan 23, 2006
Messages
15,385
anski,
This is my interpretation of the thread based on all comments. Is it correct?
You want to deal with the csv file and vba without ever importing the csv data into an Access table
 

isladogs

MVP / VIP
Local time
Today, 12:53
Joined
Jan 14, 2017
Messages
18,247
^Good explanation (specially: "The csv file is just one long text string. ")

Is it still possible for me to go through each row in the text file to run the Replace function with left and mid functions?

Probably not without importing or linking it in a table in Access as jdraw just implied. Why bother when the replace function works perfectly
 

Users who are viewing this thread

Top Bottom