Copy only part of text string

Hi,

Wonder if someone maybe able to help me please.

I have a database at work that contains details of test files. One of the
fields for each test shows that actual error that caused the file to fail.
The problem is, is that there is an awful lot of text from this field that I
don't need to extract.

The text I need to extract starts with the word Error and then the rest of
the text that comes after it in the text string. The word Error can appear
anywhere within the text string, but having worked through all of the
failures I beleive that 'Error' can be used as the guide to start extracting
from.

I'm fairly new to Access, and I did try using the 'Mid' and 'Last'
functionaity, but this didn't seem to work.

Could someone perhaps point me in the direction please of how I could put a
function/coding into a query that will extract the information and where if
the word 'Error' doesn't appear within the text string it just leaves the
field blank in the query.

Many thanks an regards

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200705/1

0
hobbit2612
5/2/2007 5:24:59 PM
access.queries 6343 articles. 1 followers. Follow

4 Replies
1033 Views

Similar Articles

[PageSpeed] 16

InStr() could be used to spot the word Error:

?  InStr("Hello, World, is that an error we just saw?"", "Error" )
26

So, you can then retrieve from that position (+5, if you don't want the word 
error itself):


Mid( myString & "Error", 5+ InStr(myString & "Error", "Error") )


Note that I appended the searched string to the initial string, so it is 
always 'found'. Indeed, if the string is not found, InStr returns 0 and Mid 
would produce an error, in that case.




Hoping it may help,
Vanderghast, Access MVP


"hobbit2612 via AccessMonster.com" <u27332@uwe> wrote in message 
news:7195904679508@uwe...
> Hi,
>
> Wonder if someone maybe able to help me please.
>
> I have a database at work that contains details of test files. One of the
> fields for each test shows that actual error that caused the file to fail.
> The problem is, is that there is an awful lot of text from this field that 
> I
> don't need to extract.
>
> The text I need to extract starts with the word Error and then the rest of
> the text that comes after it in the text string. The word Error can appear
> anywhere within the text string, but having worked through all of the
> failures I beleive that 'Error' can be used as the guide to start 
> extracting
> from.
>
> I'm fairly new to Access, and I did try using the 'Mid' and 'Last'
> functionaity, but this didn't seem to work.
>
> Could someone perhaps point me in the direction please of how I could put 
> a
> function/coding into a query that will extract the information and where 
> if
> the word 'Error' doesn't appear within the text string it just leaves the
> field blank in the query.
>
> Many thanks an regards
>
> -- 
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200705/1
> 


0
Michel
5/2/2007 5:49:50 PM
Michael,

Thanks for this.

Like I said I'm relatively new to Access so could I just check my
understanding.

With the InStr formula, do I actually have to put the text in the query field
as you have shown in the bracket? it's just that the text will be different
because it relates to different errors so i won't be able to do this.

Sorry for being a bit thick!

Could you possibly expand?

Regards

Chris

Michel Walsh wrote:
>InStr() could be used to spot the word Error:
>
>?  InStr("Hello, World, is that an error we just saw?"", "Error" )
>26
>
>So, you can then retrieve from that position (+5, if you don't want the word 
>error itself):
>
>Mid( myString & "Error", 5+ InStr(myString & "Error", "Error") )
>
>Note that I appended the searched string to the initial string, so it is 
>always 'found'. Indeed, if the string is not found, InStr returns 0 and Mid 
>would produce an error, in that case.
>
>Hoping it may help,
>Vanderghast, Access MVP
>
>> Hi,
>>
>[quoted text clipped - 24 lines]
>>
>> Many thanks an regards

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200705/1

0
hobbit2612
5/2/2007 6:24:29 PM
There is no need for the text to be a constant, it can be a field name.


ExprNNN:  Mid( FieldName & "Error", 5+ InStr(FieldName & "Error", "Error") )


in the grid, or


SELECT  Mid( FieldName & "Error", 5+ InStr(FieldName & "Error", "Error") ) 
AS ExprNNN
FROM tableName


in SQL view.


Vanderghast, Access MVP



"hobbit2612 via AccessMonster.com" <u27332@uwe> wrote in message 
news:7196152531a20@uwe...
> Michael,
>
> Thanks for this.
>
> Like I said I'm relatively new to Access so could I just check my
> understanding.
>
> With the InStr formula, do I actually have to put the text in the query 
> field
> as you have shown in the bracket? it's just that the text will be 
> different
> because it relates to different errors so i won't be able to do this.
>
> Sorry for being a bit thick!
>
> Could you possibly expand?
>
> Regards
>
> Chris
>
> Michel Walsh wrote:
>>InStr() could be used to spot the word Error:
>>
>>?  InStr("Hello, World, is that an error we just saw?"", "Error" )
>>26
>>
>>So, you can then retrieve from that position (+5, if you don't want the 
>>word
>>error itself):
>>
>>Mid( myString & "Error", 5+ InStr(myString & "Error", "Error") )
>>
>>Note that I appended the searched string to the initial string, so it is
>>always 'found'. Indeed, if the string is not found, InStr returns 0 and 
>>Mid
>>would produce an error, in that case.
>>
>>Hoping it may help,
>>Vanderghast, Access MVP
>>
>>> Hi,
>>>
>>[quoted text clipped - 24 lines]
>>>
>>> Many thanks an regards
>
> -- 
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200705/1
> 


0
Michel
5/2/2007 6:52:33 PM
Michael,

Yes I understand now. In fact I tried it at work this morning and it worked a
treat. Thanks very much, it's helped me out no end.

Appreciate your time and trouble.

Kind regards

Chris

Michel Walsh wrote:
>There is no need for the text to be a constant, it can be a field name.
>
>ExprNNN:  Mid( FieldName & "Error", 5+ InStr(FieldName & "Error", "Error") )
>
>in the grid, or
>
>SELECT  Mid( FieldName & "Error", 5+ InStr(FieldName & "Error", "Error") ) 
>AS ExprNNN
>FROM tableName
>
>in SQL view.
>
>Vanderghast, Access MVP
>
>> Michael,
>>
>[quoted text clipped - 41 lines]
>>>>
>>>> Many thanks an regards

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200705/1

0
hobbit2612
5/4/2007 7:01:32 PM
Reply:

Similar Artilces:

DVD Copy Pro for Mac
[b]DVD Copy Pro for Mac[/b] is a DVD copy software that can support D9 to D5 compression. With simple operation, it can save DVD in four different ways including directly burning to DVD disc, saving as DVD folder, copying into DVD media format that can be played by DVD Player directly, and converting as ISO file for easy movie management. Now this cool Mac DVD Copy also supports the latest released Snow Leopard. You can download [b][url=http://www.dvd-copy-mac.net/download/dvd-copy-pro-mac.zip]DVD Copy Pro for Mac[/url][/b] freely right now. [b]More information:[/b][quote]http://www.dvd-...

Picture behind text in Cells
Is there any way in which a picture can be sent behind the text in the worksheet cells? Or round the other way, is there any way to show the cells contents in front of a picture? Many thanks Bezza Format\sheet\background should do the trick RES That is a valid command. Unfortunately I've got numerous different images that need to be displayed behind cells. I need to use the cells so that the values displayed infront of the different pictures can be used in forumula's. Bezza That is a valid command. Unfortunately I've got numerous different images that need to be displaye...

Tab , setFocus doesn't hilite the text of the field
Hi, I have many fields that should be filled by the user. I added 2 more and I would like to change the tab order. I don't like using the numbers (after pressing Ctrl D, by clicking the fields I change the order) because I have too many fields and it takes time to do that. So I used the script, in each killFocus function I called setFocus function with the right field. The problem is that this function brings the cursor to the right field BUT it doesn't hilite the value in that field so in order to change this value I have first to hilite it. How can I hilite it by script? Th...

Import/copy calendar in Outlook 2003
I got a new computer and installed Office 2003, and wanted to move my calendar to the new PC. I created a new data file called Personal Folders from Old PC. I wanted to copy my calendar OVER my current one in Personal Folders, but don't see a way to do so. I can copy my old calendar into the Pesonal Folders, but can't delete the new, empty Calendar. So I have Calendar, and Calendar 1 under my Personal Folders. Any way to just import/copy my reminders/appointments into my new calendar? Thanks for any advice. Ck G'Day Cathy, 1. Use the Folder List 2. Click on the OLD Cal...

How to filter text automatically
Hi all, I have a workbook that has infomation imported in from access. the info is as shown session date Amount Due Comments 1 1/1/05 234 11 Good 2 2/2/05 123 7 Not so Good this goe's on for 12 sessions. what I need is for excel to check the session on this worksheet 'Import1' against the 'Main Sheet' cellA1 and which ever one matches then the comment is entered into 'Main Sheet' Cell F62. hope that makes sense. Cheers. Alan In cell F62 of Main Sheet, put this formu...

CRM list web part authentication question
We have SharePoint 2007 and CRM 3.0 and would like to install the CRM list web part (http://www.microsoft.com/downloads/details.aspx?FamilyId=BC9B3526-DECF-4057-A530-91840C0D5401&displaylang=en). The problem is that we have NTLM authentication setup and need to keep it that way and the CRM list web part needs to use Kerberos authentication. From what I have read is that you can only have one authentication method per zone. With this in mind I was wondering if it would be possible for me to create a new zone within SP and have it use Kerberos authentication. I’d setup the CRM list...

Copy info from one workbook to another?
I have a problem I have a workbook with the function i want like a discribe here. The problem is i want to split the workbook but i don`t know how. Is it possible to have a main workbook with information from other workbooks at each worksheet? I have 20 workbooks with information. I would like to have a main workbook with on sheet1 every row from the 20workbooks with category1, on sheet2 every row from the 20workbooks with category2, etc, etc. The information in the 20workbooks in always only on sheet. The Colum in which the data is has no fix end. I go to fill in the rows trough a...

Secondary Copy
Hi, My customer using Great Plains modified report(Primary Copy). Now he wants new report something similar to the modified GP report with very few changes. I tried to copy the modified report and planned to use us a secondary copy. But the report has temp tables, so I am unable to make secondary copy. Can some one help me in how to make a new report something similar to the modified report, where to launch it. Whether it is possible throught VBA & Modifier? Regards Selvakumar.S A report with a temporary table can only be a primary copy. This is because only a primary copy can b...

local copy of mail
How do you store a copy of all your mail on you local computer when using Exchange? You setup an OST/Offline Folders file. Check with your mail admin if they support that configuration. "Brandon Baker" <brandon@discussions.microsoft.com> wrote in message news:epNKuJ19FHA.4004@TK2MSFTNGP14.phx.gbl... > How do you store a copy of all your mail on you local computer when using > Exchange? > ...

Text to column and paste special transpose
Hi All, I have 1 table like this item_number qty ref 00010-001 3 U34,U36,U43 00013-001 2 U16,U21 12505-001 3 U32,U33,U42 12512-001 3 U5,U6,U27 and 1 want it to become like this item_number qty ref 00010-001 3 U34 00010-001 3 U36 00010-001 3 U43 00013-001 2 U16 00013-001 2 U21 12505-001 3 U32 12505-001 3 U33 12505-001 3 U42 12512-001 3 U5 12512-001 3 U6 12512-001 3 U27 Anybody can help me to program it in macro.. usually i do it manually and have to redo again do to careless. After using Text to Columns on Column C.......comma delimited.........Run the Reorganize macro. Sub ReOrganize...

Outlook 2000 SP3
How can I copy my mail and calendar to CD so that I can take my received and sent mail history to a new computer with Outlook installed? Thanks. >-----Original Message----- >How can I copy my mail and calendar to CD so that I can >take my received and sent mail history to a new computer >with Outlook installed? Thanks. >. > All your data saves in C:\Documents and Settings\Username\Local Settings\Application Data\Microsoft\Outlook\archive.pst and C:\Documents and Settings\Evgeni\Local Settings\Application Data\Microsoft\Outlook\outlook.pst You can either install instan...

CDaoTableDef
I'm developing an application that uses the MicroSoft Access Jet DB engine. This is being done using C++ in VS.net. I need to change the user's db when they use the new version of the program. In particular I need to change the length of a text field in a pre-existing db without loosing the user's data. When I wanted to add a new field I used CDaoTableDef and it worked fine, but I can't locate a method to just update an existing field's properties. Any Ideas on how this can be done?? Thanks, Neil Neil if you need to alter the attributes of a tabledef object, you ...

Parsing Text When Only One Character Can Be Used To Search
Hello: I've spent a couple of hours looking on this site, and have found some excellent new tips, but still need to ask for assistance. I have a series of text rows containing one string that I need to parse. There are no characters I can use as delimeters (inconsistent), and there is no consistent use of text qualifiers; it's in effect, free form text. Here's a sample record ------------------------------------------------------------------------------------------ FROM per_requisitions_v@appslink req2, per_vacancies@appslink vac2, What I need to pull from this string is --...

Copy picture ossice wizard
I have project 2007 standard edition, but the button is not working at all? Any suggestions Hi, The wizard is IMHO useless. Go to Roport, Copy Picture and do without the Wizard what millions have done before the Wizard existed. HTH -- Jan De Messemaeker Microsoft Project Most Valuable Professional +32 495 300 620 For availability check: http://users.online.be/prom-ade/Calendar.pdf "Enrique" <Enrique@discussions.microsoft.com> wrote in message news:72B5AA6C-67AE-468D-B6AE-FF16F52E57BD@microsoft.com... >I have project 2007 standard edition, but the bu...

Expanding Text Box
One one slide: I need to click on title 1 and have a text box appear...then disappear when I click on title 2...and so on. Without using a macro, how can I achieve this? Thank you. Use Custom Animation to set entrance and exit on mouse click, the exact steps would be somewhat dependent on the version of PP your are using. -- James Bart: "According to creationism, there were no cavemen." Homer: "Good riddance! Their drawings sucked and they looked like hippies." "Gina" <Gina@discussions.microsoft.com> wrote in message news:EA63087D-5125-4...

Copy and paste versus copy and insert copied cells
What is the difference between these commands? Try them, it is pretty easy to see the difference -- Regards, Peo Sjoblom "Alana" <Alana@discussions.microsoft.com> wrote in message news:879FED29-5541-41B0-BB2C-7108D42ED593@microsoft.com... > What is the difference between these commands? ...

subtotal copy and paste
Hi I have used the subtotal option in Excel and this is fine. I have also collasped the list so only the subtotal for each category is visible. However I want to copy and paste this list (just the subtotal) into another sheet When I do this it expands and shows all the results. Is it possible to just copy the visible bit. I have looked in paste special but no luck Cheers Hager On Jan 21, 6:38=A0am, Hager <Ha...@discussions.microsoft.com> wrote: > Hi > > I have used the subtotal option in Excel and this is fine. I have also > collasped the list so only the...

How do I change the text in a workbook from upper to lower case
Hi Please can anyone help with this one! I have a large workbook that I have created (just with text - no formulas) and I have done it in caps but now want to change all the text to lower case without having to re-type it all. Excel hslp is confusing so can anyone tell me how to do it please Thanks Mike Hi see: http://www.cpearson.com/excel/case.htm -- Regards Frank Kabel Frankfurt, Germany mike wrote: > Hi > > Please can anyone help with this one! > > I have a large workbook that I have created (just with text - no > formulas) and I have done it in caps but now...

Modify "quick part" in Outlook 2007
Hello, Does anyone know how to modify the contents (not just the description, category,...) of a "quick part" saved in Outlook 2007? Thanks beforehand, Philippe Insert the Quick Part, modify what you want and then add the Quick Part again. -- Robert Sparnaaij [MVP-Outlook] Coauthor, Configuring Microsoft Outlook 2003 http://www.howto-outlook.com/ Outlook FAQ, HowTo, Downloads, Add-Ins and more http://www.msoutlook.info/ Real World Questions, Real World Answers ----- "Philippe De Ridder" <PhilippeDeRidder@discussions.microsoft.com> wrote in...

Copy above fails one way, copy below fails another way
I have a table of blood pressure readings that looks something like this: A B C D E 11 12 Averages: 134 83 74 13 R# Date Sys Dia Pul 14 4 8/17/08 138 87 72 15 3 8/15/08 130 84 76 16 2 8/12/08 137 83 70 17 1 8/11/08 129 79 76 Cell A14 contains =A15+1 Cell C12 contains =AVERAGE(C14:C17) Cell D12 contains =AVERAGE(D14:D17) Cell E12 contains =AVERAGE(E14:E17) Every time I take a new reading, I want to add a row to the top of the table, between row 13 (the header) and row 14 (the previous top row). I want to push a...

Business Portal "Copy to Excel" not working in Query pages
Hi, I am using Business Portal 4.0. When browsing through one of the queries pages in Business Portal, i clicked "Copy to Excel" icon. I got an error saying "The Office Web Components (OWC) must be installed to copy results to Excel." at the bottom. I am using Office 2007 on my machine. I came to know that Microsoft Office Web Components will no longer be shipping in Microsoft Office. I tried installing Office 2003 Add-in: Office Web Components from http://www.microsoft.com/downloads/details.aspx?familyid=7287252C-402E-4F72-97A5-E0FD290D4B76&displaylang=en a...

Copying graphs
Hi Is it possible to range value a graph ie I would like to copy the graph to another workbook, show all the information but without the links? Thanks You could copy the chart as a picture, then paste it wherever you want. Select the chart, hold Shift while clicking on the Edit menu, Choose Copy Picture, and select the On Screen and As Picture options, then go to the other workbook/sheet and Paste. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Dixie" <Dixie@discussions.micr...

Count text with specific criteria ignoring N/A and blanks
Hello I have a list of survey names in A3:A726 and peoples names in Y3:Y726. Column Y also contains N/A and blanks. I am doing a summary table on the next sheet so I need a formula to show if it is 'SurveyName="Manchester" then count 'Autumn 09'!Y3:Y726 to show it has 42 names listed against it (ignoring N/As) Any help would be greatly appreciated. Many thaks Paula Hi, Try this =sumproduct((sheet1!A3:A726="Manchester")*(sheet1!Y3:Y726<>"N/A")*(sheet1!Y3:Y726<>"")) I have not tried this but it should wo...

Copying Views
Is there any way to copy the views under leads so that i can modify them and create different ones. I need to create 15 views and i do not want to do all of them one at a time. Even if there is a way to do it in sql i would love to know -- IT Manager It can be done in SQL, though it's unsupported. What you want need to do is use INSERT ... SELECT to copy rows in the savedquerybase, and give a different savedqueryid For a supported route you can use the CRM web service and create new instances of savedquery. The following article describes how to do this for the userquery, and coul...

Assign Numeric Value to Text
Hi Everyone, I am looking for a way to assign numberical values to 2 different letters (i.e. A equal to 1, B equal to 2). Then what I am looking to do with this is add up, all the letters in numerical value, in a column and get a total on 1 row and then the average on a 2nd row. Any and all help is greatly appreciated. Happy New Years! :D --- Message posted from http://www.ExcelForum.com/ For a range A1:A100 with just one letter in each cell:- =SUMPRODUCT(CODE(UPPER($A$1:$A$100))-64) -- Regards Ken....................... Microsoft MVP - Excel Sys Spe...