parse data from text field

I currently have a field in a form that contains the exact path to files 
stored on my computer (ex. C:\file1\file2\file3\samplefile.doc).  The path to 
the file is different for most of the files.  I have changed some things in 
the database and I would like to parse just the file name and extension (ex. 
samplefile.doc).  I have tried the Mid, Left, Right, and InStr functions but 
I have not been able to get the desired data.  Any help with code to parse 
the data correctly would be appreciated.  The names of files are not equal in 
length.

Thank you
0
Utf
1/6/2010 1:52:01 AM
access.modulesdaovba 1670 articles. 0 followers. Follow

4 Replies
1778 Views

Similar Articles

[PageSpeed] 36

accessuser1308,

You kinda need a combination...  Paste the below into a query...

MyFile: 
Right([FieldNameThatContainsFullPath],Len([FieldNameThatContainsFullPath])-InStrRev([FieldNameThatContainsFullPath],"\"))

-- 
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors 
II

http://www.regina-whipp.com/index_files/TipList.htm

"accessuser1308" <accessuser1308@discussions.microsoft.com> wrote in message 
news:E70815D3-EDBB-4866-80BF-DB4039803D8F@microsoft.com...
>I currently have a field in a form that contains the exact path to files
> stored on my computer (ex. C:\file1\file2\file3\samplefile.doc).  The path 
> to
> the file is different for most of the files.  I have changed some things 
> in
> the database and I would like to parse just the file name and extension 
> (ex.
> samplefile.doc).  I have tried the Mid, Left, Right, and InStr functions 
> but
> I have not been able to get the desired data.  Any help with code to parse
> the data correctly would be appreciated.  The names of files are not equal 
> in
> length.
>
> Thank you 


0
Gina
1/6/2010 2:20:01 AM
"accessuser1308" <accessuser1308@discussions.microsoft.com> wrote in message 
news:E70815D3-EDBB-4866-80BF-DB4039803D8F@microsoft.com...
>I currently have a field in a form that contains the exact path to files
> stored on my computer (ex. C:\file1\file2\file3\samplefile.doc).  The path 
> to
> the file is different for most of the files.  I have changed some things 
> in
> the database and I would like to parse just the file name and extension 
> (ex.
> samplefile.doc).  I have tried the Mid, Left, Right, and InStr functions 
> but
> I have not been able to get the desired data.  Any help with code to parse
> the data correctly would be appreciated.  The names of files are not equal 
> in
> length.
>
> Thank you

You'll find all you need for slicing & dicing paths here:

http://www.smccall.demon.co.uk/Strings.htm#PathFuncs

FilePart is the function you need immediately.


0
Stuart
1/6/2010 3:18:39 AM
On Tue, 5 Jan 2010 17:52:01 -0800, accessuser1308 wrote:

> I currently have a field in a form that contains the exact path to files 
> stored on my computer (ex. C:\file1\file2\file3\samplefile.doc).  The path to 
> the file is different for most of the files.  I have changed some things in 
> the database and I would like to parse just the file name and extension (ex. 
> samplefile.doc).  I have tried the Mid, Left, Right, and InStr functions but 
> I have not been able to get the desired data.  Any help with code to parse 
> the data correctly would be appreciated.  The names of files are not equal in 
> length.
> 
> Thank you

=Mid([FieldName],InStrRev([FieldName],"\")+1)
-- 
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
0
fredg
1/6/2010 3:22:11 AM
If you wanted to confirm that the file actually existed, you could use:
   strFileName = DIR([FilePath])
If strFileName is zero-length then the file does not exist at the specified 
location.

Otherwise you can use an expression like:
   strFileName = Mid([FilePath],InStrRev([FilePath],"\")+1)

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

accessuser1308 wrote:
> I currently have a field in a form that contains the exact path to files 
> stored on my computer (ex. C:\file1\file2\file3\samplefile.doc).  The path to 
> the file is different for most of the files.  I have changed some things in 
> the database and I would like to parse just the file name and extension (ex. 
> samplefile.doc).  I have tried the Mid, Left, Right, and InStr functions but 
> I have not been able to get the desired data.  Any help with code to parse 
> the data correctly would be appreciated.  The names of files are not equal in 
> length.
> 
> Thank you
0
John
1/6/2010 3:03:58 PM
Reply:

Similar Artilces:

Looking for an excel function which can mirror opposite the data
Dear sir, There are 2 data sets is assumed running in A1 down, viz.: From A1 down to A10, are showing a set of number: from 1 to 10 In the cell from B1 to B10, are showing from 10 to 1, which is decreasing from 10 to 1. My question: I want to know is there any excel formula which I can place in B1 and pick A10's number; B2 pick A9's number and etc. I know there is an easy way to do it, just type "=A10" in the cell of B1, but it is quite difficult to do it when I have more than 200 number, e.g. A1 to A200. Thanks for your advice, Wilchong -- Message posted via OfficeKB...

Averaging weekly data into Months
Ive got a string of weekly data ranging from 1993-2010, which i need to convert from weekly to monthly. Id like to do this so that in the future new weekly data can be automatically converted to its monthly average. Whats the best way to do this? Maybe this will be useful to you... Step1: (If your weekly-date is in column B) Make a new column near your data, with formula in each line as "=eomonth(b1,0)" This will bring month value of each data-line, so later you can summarise/condense your data through this column value. Step2: In your monthly summary, use refe...

Drop line on only one data point in series
Is it possible to add a drop line to only one data point in a series? If so, how? I believe attaching an autoshape line to a single data point would also meet my needs. I would like to be able to have a single data point marked with a line that doesn't require repositioning every time I add new points to the end of the series, which is daily. Any ideas? An autoshape would move anytime a heavy truck drove by. You could add custom negative error bars to the series, where the range containing the values contained zero for each point except for the one you want the drop line for. Easie...

Pulling data for a report from a form
Hi, I have a product report list that want to show the on hand qty. so i have this formula in a report field: =onHand([pkProductID],Forms!FrmMyDate!InvDateQty) but when i preview the report it shows #name? instead. Thank you -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access/200912/1 To refer to a textbox on another (open) form, use: =Forms!FrmMyDate!InvDateQty -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "josros60 via AccessMonster.com" <u56159@uw...

Unable to add custom field to a view/preview
I added a new attribute to the Quote and I am able to add this attribute to the form but the new attribute does not appear in the list of fields when I create a new view. Further, the new field does not appear in the list of fields if I try to add it to the quote preview. I am able to store and retrieve the value of the new field using the API. Thanks for any info. I figured it out. JohnE wrote: > I figured it out. Hi John! How do you solve the problem? Publish and IIS reset don't help. I don't see custom fields in "Customize views", but i can see custom fields ...

autofit: cell height expands with text entered?
For a form: can a user enter mass quantities of text in a cell and have the cell depth expand so it fits? does Merging Cells limit this ability? I made a giant cell to handle the text the user might enter. I can't figure out where to set this... I have copied & pasted formatting from one worksheet to another without luck. Thanks. Sandy Merged cells don't adjust rowheight for wrapped text (like non-merged cells do). Jim Rech wrote a macro called AutoFitMergedCellRowHeight that you may like: http://groups.google.com/groups?threadm=e1%241uzL1BHA.1784%40tkmsftngp05 Sandy wrote:...

Text String to Unicode
Hi, How do I convert a text string (from a text file) that has escaped unicode charactes (\u0635\u0641\u0627\u0631) to unicode chars? Thanks, Guilherme R. Rolim Look at macros A2W etc. -- Ajay Kalra [MVP - VC++] ajaykalra@yahoo.com "Guilherme R. Rolim" <grrolim@yahoo.com.br> wrote in message news:OXR7gzxkDHA.988@TK2MSFTNGP10.phx.gbl... | Hi, | | How do I convert a text string (from a text file) that has escaped unicode | charactes (\u0635\u0641\u0627\u0631) to unicode chars? | | Thanks, | | Guilherme R. Rolim | | | | I'll try to put some more details, mayb...

Field Service V2.0
I know that there probably isn't a lot of solid info avail about feature set for V2.0 but I have seen a number of references to planned addition of some type of Field Service functionality. My question is.... Does anybody have any insight or thoughts as to whether or not the ability to schedule/dispatch techs and the ability to generate invoicing for field service calls will be included? There is something referred to as Service Scheduling in the latest information that I have seen. "SteveT" <drumguy61-google@yahoo.com> wrote in message news:1102972818.458191.150090@z14...

How do I convert time format to text?
I have a cell with a formula of =text(c3-b3,"h:mm") as the difference from cell b3 and c3. Assume the result is 5:00. I need to minus another cell value that is formatted as general text. eg. =text(c3-b3,"h:mm")-G3 Thanks....Andrew Hi Andrew- Try the VALUE() fx and format that cell with your choice of Time Formats. HTH |:>) "Andrew" wrote: > I have a cell with a formula of =text(c3-b3,"h:mm") as the difference from > cell b3 and c3. Assume the result is 5:00. I need to minus another cell value > that is formatted as general text. ...

right align int fields
I would like to right align integer fields. I would like to do this in a while/for loop in onLoad event, because I have many fields. How can I see in javascript if a field (I do not mean the value of a field) is an integer. Marc ...

Custom Formatting a Chart Data Label
I want to create a chart which will display a zero value on the data label where there is in fact a zero value, and show N/A on the data label where it didn't apply. The formula I am using in the spreadsheet uses a nested formula to make this determination: =IF(AND(B22+C22>0,C22>0),B22/C22,NA()) Presently, it works but displays the #N/A on the chart where I would prefer it simply displayed as N/A. Can I do this with a custom format on the data label?? Thanks so much! I don't know how you all do it but your amazing! -- If you can read this, thank a Teacher... If your read...

pivot table changes when data is refreshed.
Hi, I have a pivot table with grouping based on a field called "period which is of date type. I have grouped it into months and quarters However when i refresh the pivot table whenever the data (which is in seperate sheet) is changed, the groupings are going out. I want t preserve the groupings as they are like a template. How do i stop th changing the format and layout of the pivot table whenever i refres the data? any ideas? please help. regards Kiran:mad ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages d...

moving text from a word document to excel
I'm moving a large amount of text from word documents to an excel spreedsheet, and I have a few questions: 1. When I copy/paste text from the document to the spreedsheet, the text will sometimes expand the cell very large. How can I keep all the cells the same size? 2. When I click on a cell that has text in it to read it, sometimes it will only show the text in a long downwards column, whereas other times it shows it as a big 'blurb' to the right side (which makes it easier to read). How can I set it up so it is not in a long column? 3. How can I insert cells without h...

Redefine field data type
Hi, I am trying to write a function in a module in MS Access 2000 that will change the data type of a field called 'Start' in table 'bo_cpm_CS01ALL'. Here is the code that I have done so far but when I run it nothing happens...no errors or changes to the table. The code finds the table and field, creates a new field called 'temp' then copys 'Start' to 'temp' then deletes 'Start' and renames 'temp'. The field 'Start' has data type dbDouble. Any help would be great!! Public Function ChangeFieldType() 'Purpose: Changes a f...

How do I increase size of text when typing?
I am using Word 2003 and with Word 2000 I could enlarge the size of the print before typing to increase to 150% but cannot find how to do this in the 2003 version. The print on the screen is now about a 10 which is too small for comfort. View | Zoom. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "Sufimai" <Sufimai@discussions.microsoft.com> wrote in message news:1125090F-6AB0-404F-8B1C-E5EAF06917F8@microsoft.com... >I am using Word 2003 and with Word 2000 I could enlarge the size of the >p...

sp_columns does not return NVARCHAR data type columns
Hi, our SQL Server Version is 2000 SP4. For several days the SP "sp_columns" does not return NVARCHAR data type columns any more. I reviewd the SP "sp_columns" and it seems, that the used SP "spt_datatype_info" does not return that type any more. A second production server returns that column type. The SP "sp_columns" is used by the ODBC-Driver to determine the table columns. Any suggestions? Thanks a lot, Nils Ok, my fault, it seems that "spt_datatype_info" is a table and there is no NVARCHAR row. After insert...

Charts not recognizing source data if original linked data is changed.
I am very frustrated by Excel (2003) at the moment. I'm relatively new to using Excel in depth. I have always been able to work my way through most intricacies and pitfalls. But now I have been working in a workbook with linked sheets (and with linked workbooks too) and have two problems that I cannot solve. Right now, I have about 47 sheets that are set up as follows: detail data: this is the raw data the the user enters daily totals: this is calculated data from the detail sheets summary sheets: further sums from the daily totals and a chart object that charts these sums (a line or sc...

center text when conditional format applied
Textbox control on Access 2007 form lost its centered alignment when conditional formatting is applied. This did not happen in previous versions of Access. I tried using format painter to apply conditional formats from a control created in an earlier version, but this failed. The control created in the earlier version then lost it's centering after saving in Access 2007. -- Roy Handy Interesting. I tried to replicate this behaviour but failed, it all worked as it should. Try revisiting your form after applying the conditional formatting and resetting the text box to center text. ...

Bold text appears in print preview but does not print bold
I am working on a menu in Publisher. In print preview, all text in bold appears bold, but when I actually print, portions of the bold text does not print in bold. This problem applies to all text within specific text boxes. For some text boxes the bold prints and for some it doesn't. Any suggestions would be enormously appreciated. What version Publisher? Don't know if that makes a difference however. If you look in the font directory in the control panel you will see a separate font for bold, italic, condensed and so on for fonts like Times New Roman and Arial. If you use ...

how do i enter data for a # of years using a formula?
i am working on excel and the book asks that i enter data s=using formulas for specifically the last three years of what i am referencing to. and i have to know how to us the copy command button. can anyone help ...

Do a calculation in cells with text data format
I have a few columns of cells having a mixed data format of number and text. Is it possible to convert the first row of numbers in text data format for further calculation? Your guidance to accomplish it is appreciated. Thanks, Ray Example? -- Regards, Peo Sjoblom "Ray" <NoSpam-ZQLi@GMail.com> wrote in message news:ei$Jbmy$FHA.216@TK2MSFTNGP15.phx.gbl... > I have a few columns of cells having a mixed data format of number and text. > Is it possible to convert the first row of numbers in text data format for > further calculation? Your guidance to accomplis...

Where has the data map tool gone to in Excel 2003?
Cannot find it in 2003. Was there in earlier versions of Excel. It's gone as of Exel 2002. Here is MS's statement and a link to another program for map making. http://office.microsoft.com/en-us/assistance/HA010346591033.aspx tj "macray" wrote: > Cannot find it in 2003. Was there in earlier versions of Excel. If it still resides on the hard drive, you can use it from later Excel versions, through the Insert Object dialog. But I think uninstallation is pretty good at wiping it out. In my case, I have multiple versions of Excel installed on one machine, so Excel 2003...

Changing Report Fields
What happens to the reports if we change screen fields. Does anyoneknow what happens in the event of: - adding a field – presumably doesn’t appear on any report - changing a field – label or properties - removing a field? Any help please? Hi, - Adding a field would change nothing to a report. You will have to alter the report itself to make it visible there. - Labels are set inside the report itself, so this won't change if you change them on the form. - Removing the field will not change the report, but it will be empty becaus the user cannot enter data for that field (unless som...

Text to Date
I have been given a database dump (thousands of rows) that put the dates in a text format like this: Aug/11/2009 Is there any way to put this into a date format? Even if it means creating a new field breaking it up and doing some extra steps. Thanks. Change to appropriate cell reference: =DATEVALUE(SUBSTITUTE(A1,"/",", ")) -- Best Regards, Luke M "PAL" <PAL@discussions.microsoft.com> wrote in message news:2E5E64F4-8B6A-44D5-95C9-8FD45A326DB3@microsoft.com... >I have been given a database dump (thousands of rows) that put the da...

Finding data in grouped sheets
When using the 'find' option whilst workbook pages are grouped together I am getting data from the last page first, then the last but one etc. Can anyone tell me whether it is possible to change this so that it finds the data in the first possible page, ie it looks at page 3 before page 4 etc? What I am trying to do is set up a spreadsheet which finds the first 'vacancy' in a childrens nursery. As I have set it up at the moment it is finding the last vacancy first! All help greatly received! Thanks in advance. Susie Vaughan This may not quite fit, but you may find it very us...