If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Extracting Text
I have a table with one single text field.
S:\ENG\DATA\DWN\my file_1.pdf S:\ENG\DATA\DWN\CUSTOMER\MSG\file.pdf S:\ENG\DATA\DWN\CUSTOMER\My Subdir\my_other file.pdf How do I extract the file name and the file path and save it on two text fields? the_path S:\ENG\DATA\DWN S:\ENG\DATA\DWN\CUSTOMER\MSG S:\ENG\DATA\DWN\CUSTOMER\My Subdir the_file my file_1.pdf file.pdf my_other file.pdf There are two constants: the file extension ".pdf" and the "S:\ENG\DATA\" Thank you all Bre-x |
#2
|
|||
|
|||
Extracting Text
On Tue, 14 Jul 2009 14:11:14 -0600, "Bre-x" wrote:
I have a table with one single text field. S:\ENG\DATA\DWN\my file_1.pdf S:\ENG\DATA\DWN\CUSTOMER\MSG\file.pdf S:\ENG\DATA\DWN\CUSTOMER\My Subdir\my_other file.pdf How do I extract the file name and the file path and save it on two text fields? the_path S:\ENG\DATA\DWN S:\ENG\DATA\DWN\CUSTOMER\MSG S:\ENG\DATA\DWN\CUSTOMER\My Subdir the_file my file_1.pdf file.pdf my_other file.pdf There are two constants: the file extension ".pdf" and the "S:\ENG\DATA\" Thank you all Bre-x In A2002 (possibly 2003, I'm not certain) and later there's a function InStrRev that will do this: the_path: Left([fieldname], InStrRev([fieldname], "\") - 1) the_file: Mid([fieldname], InStrRev([fieldname], "\") + 1) -- John W. Vinson [MVP] |
#3
|
|||
|
|||
Extracting Text
Path: Left([YourTextField], InStrRev([YourTextField], "/"))
File: RightLeft([YourTextField], (Len([YourTextField])+1) -[InStrRev([YourTextField], "/")) -- Build a little, test a little. "Bre-x" wrote: I have a table with one single text field. S:\ENG\DATA\DWN\my file_1.pdf S:\ENG\DATA\DWN\CUSTOMER\MSG\file.pdf S:\ENG\DATA\DWN\CUSTOMER\My Subdir\my_other file.pdf How do I extract the file name and the file path and save it on two text fields? the_path S:\ENG\DATA\DWN S:\ENG\DATA\DWN\CUSTOMER\MSG S:\ENG\DATA\DWN\CUSTOMER\My Subdir the_file my file_1.pdf file.pdf my_other file.pdf There are two constants: the file extension ".pdf" and the "S:\ENG\DATA\" Thank you all Bre-x |
#4
|
|||
|
|||
Extracting Text
On Tue, 14 Jul 2009 14:15:01 -0700, KARL DEWEY
wrote: Path: Left([YourTextField], InStrRev([YourTextField], "/")) File: RightLeft([YourTextField], (Len([YourTextField])+1) -[InStrRev([YourTextField], "/")) Karl, is RightLeft something you wrote or a typo? Shouldn't that be just: Mid([YourTextField], InStrRev([YourTextField], "\") + 1) Note that the Mid() function gets the rest of the string after the position in the second argument if the third argument is absent, so you don't need to subtract from the length of the field. -- John W. Vinson [MVP] |
#5
|
|||
|
|||
Extracting Text
Yes, I saw my typo after I read your first post.
-- Build a little, test a little. "John W. Vinson" wrote: On Tue, 14 Jul 2009 14:15:01 -0700, KARL DEWEY wrote: Path: Left([YourTextField], InStrRev([YourTextField], "/")) File: RightLeft([YourTextField], (Len([YourTextField])+1) -[InStrRev([YourTextField], "/")) Karl, is RightLeft something you wrote or a typo? Shouldn't that be just: Mid([YourTextField], InStrRev([YourTextField], "\") + 1) Note that the Mid() function gets the rest of the string after the position in the second argument if the third argument is absent, so you don't need to subtract from the length of the field. -- John W. Vinson [MVP] |
#6
|
|||
|
|||
Extracting Text
Thank you all!!
"Bre-x" wrote in message ... I have a table with one single text field. S:\ENG\DATA\DWN\my file_1.pdf S:\ENG\DATA\DWN\CUSTOMER\MSG\file.pdf S:\ENG\DATA\DWN\CUSTOMER\My Subdir\my_other file.pdf How do I extract the file name and the file path and save it on two text fields? the_path S:\ENG\DATA\DWN S:\ENG\DATA\DWN\CUSTOMER\MSG S:\ENG\DATA\DWN\CUSTOMER\My Subdir the_file my file_1.pdf file.pdf my_other file.pdf There are two constants: the file extension ".pdf" and the "S:\ENG\DATA\" Thank you all Bre-x |
Thread Tools | |
Display Modes | |
|
|