A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Remove text in brackets from query



 
 
Thread Tools Display Modes
  #1  
Old August 15th, 2005, 05:47 PM
JanetF
external usenet poster
 
Posts: n/a
Default Remove text in brackets from query

Hello,

I have a first name field in a query that has text in brackets after the
first name. I would like to remove the brackets and the text within the
brackets. How do I go about doing this? Thanks in advance.

Janet
  #2  
Old August 15th, 2005, 05:59 PM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

Look at the Left, InStr, etc. string functions to do what you want.
--

Ken Snell
MS ACCESS MVP


"JanetF" wrote in message
...
Hello,

I have a first name field in a query that has text in brackets after the
first name. I would like to remove the brackets and the text within the
brackets. How do I go about doing this? Thanks in advance.

Janet



  #3  
Old August 15th, 2005, 06:27 PM
JanetF
external usenet poster
 
Posts: n/a
Default

Thanks, but I need a bit more information than that. The text in brackets is
sometimes there and sometimes not. It can be any imaginable length. I need
to know how to not include anything in brackets in the query results. Thanks.

Janet

"Ken Snell [MVP]" wrote:

Look at the Left, InStr, etc. string functions to do what you want.
--

Ken Snell
MS ACCESS MVP


"JanetF" wrote in message
...
Hello,

I have a first name field in a query that has text in brackets after the
first name. I would like to remove the brackets and the text within the
brackets. How do I go about doing this? Thanks in advance.

Janet




  #4  
Old August 15th, 2005, 06:35 PM
Ofer
external usenet poster
 
Posts: n/a
Default

You can try this

IIF(instr(FieldName,"[")=true,left(FieldName,instr(FieldName,"[")-1) &
mid(FieldName,instr(FieldName,"]")+1), FieldName)


--
In God We Trust - Everything Else We Test


"JanetF" wrote:

Thanks, but I need a bit more information than that. The text in brackets is
sometimes there and sometimes not. It can be any imaginable length. I need
to know how to not include anything in brackets in the query results. Thanks.

Janet

"Ken Snell [MVP]" wrote:

Look at the Left, InStr, etc. string functions to do what you want.
--

Ken Snell
MS ACCESS MVP


"JanetF" wrote in message
...
Hello,

I have a first name field in a query that has text in brackets after the
first name. I would like to remove the brackets and the text within the
brackets. How do I go about doing this? Thanks in advance.

Janet




  #5  
Old August 15th, 2005, 07:29 PM
JanetF
external usenet poster
 
Posts: n/a
Default

Thank you so much Ofer!! That worked! I am so grateful.

Janet

"JanetF" wrote:

Hello,

I have a first name field in a query that has text in brackets after the
first name. I would like to remove the brackets and the text within the
brackets. How do I go about doing this? Thanks in advance.

Janet

  #6  
Old August 15th, 2005, 07:34 PM
JanetF
external usenet poster
 
Posts: n/a
Default

Ofer,

I just thanked you for this and said it worked, but after looking more
closely at my query results, I realized that what happened was all records
that included bracketed text in the "GIVEN_NAMES" field are now not showing.
I need them to show, just without the bracketed text included. Hope you can
help. Thanks.

Janet

"Ofer" wrote:

You can try this

IIF(instr(FieldName,"[")=true,left(FieldName,instr(FieldName,"[")-1) &
mid(FieldName,instr(FieldName,"]")+1), FieldName)


--
In God We Trust - Everything Else We Test


"JanetF" wrote:

Thanks, but I need a bit more information than that. The text in brackets is
sometimes there and sometimes not. It can be any imaginable length. I need
to know how to not include anything in brackets in the query results. Thanks.

Janet

"Ken Snell [MVP]" wrote:

Look at the Left, InStr, etc. string functions to do what you want.
--

Ken Snell
MS ACCESS MVP


"JanetF" wrote in message
...
Hello,

I have a first name field in a query that has text in brackets after the
first name. I would like to remove the brackets and the text within the
brackets. How do I go about doing this? Thanks in advance.

Janet



  #7  
Old August 15th, 2005, 07:41 PM
Ofer
external usenet poster
 
Posts: n/a
Default

In the first post you asked for
would like to remove the brackets and the text within the brackets

In that case try and use the replace function to remove the brackets

Replace(Replace(FieldName,"[",""),"]","")

I hoped that helped

--
In God We Trust - Everything Else We Test


"JanetF" wrote:

Ofer,

I just thanked you for this and said it worked, but after looking more
closely at my query results, I realized that what happened was all records
that included bracketed text in the "GIVEN_NAMES" field are now not showing.
I need them to show, just without the bracketed text included. Hope you can
help. Thanks.

Janet

"Ofer" wrote:

You can try this

IIF(instr(FieldName,"[")=true,left(FieldName,instr(FieldName,"[")-1) &
mid(FieldName,instr(FieldName,"]")+1), FieldName)


--
In God We Trust - Everything Else We Test


"JanetF" wrote:

Thanks, but I need a bit more information than that. The text in brackets is
sometimes there and sometimes not. It can be any imaginable length. I need
to know how to not include anything in brackets in the query results. Thanks.

Janet

"Ken Snell [MVP]" wrote:

Look at the Left, InStr, etc. string functions to do what you want.
--

Ken Snell
MS ACCESS MVP


"JanetF" wrote in message
...
Hello,

I have a first name field in a query that has text in brackets after the
first name. I would like to remove the brackets and the text within the
brackets. How do I go about doing this? Thanks in advance.

Janet



  #8  
Old August 15th, 2005, 08:08 PM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

Giving a completely generic answer sometimes is misleading, especially when
one learns (as you have said here) that the original question was not
complete.

Something such as this:

MyName: Left([FirstName], IIf(InStr([FirstName], "[")=0, Len([FirstName],
InStr([FirstName], "[")-1)

--

Ken Snell
MS ACCESS MVP


"JanetF" wrote in message
...
Thanks, but I need a bit more information than that. The text in brackets
is
sometimes there and sometimes not. It can be any imaginable length. I
need
to know how to not include anything in brackets in the query results.
Thanks.

Janet

"Ken Snell [MVP]" wrote:

Look at the Left, InStr, etc. string functions to do what you want.
--

Ken Snell
MS ACCESS MVP


"JanetF" wrote in message
...
Hello,

I have a first name field in a query that has text in brackets after
the
first name. I would like to remove the brackets and the text within
the
brackets. How do I go about doing this? Thanks in advance.

Janet






  #9  
Old August 15th, 2005, 08:25 PM
JanetF
external usenet poster
 
Posts: n/a
Default

Sorry if I wasn't clear. This one worked. Thanks so much.

Janet

"Ofer" wrote:

In the first post you asked for
would like to remove the brackets and the text within the brackets

In that case try and use the replace function to remove the brackets

Replace(Replace(FieldName,"[",""),"]","")

I hoped that helped

--
In God We Trust - Everything Else We Test


"JanetF" wrote:

Ofer,

I just thanked you for this and said it worked, but after looking more
closely at my query results, I realized that what happened was all records
that included bracketed text in the "GIVEN_NAMES" field are now not showing.
I need them to show, just without the bracketed text included. Hope you can
help. Thanks.

Janet

"Ofer" wrote:

You can try this

IIF(instr(FieldName,"[")=true,left(FieldName,instr(FieldName,"[")-1) &
mid(FieldName,instr(FieldName,"]")+1), FieldName)


--
In God We Trust - Everything Else We Test


"JanetF" wrote:

Thanks, but I need a bit more information than that. The text in brackets is
sometimes there and sometimes not. It can be any imaginable length. I need
to know how to not include anything in brackets in the query results. Thanks.

Janet

"Ken Snell [MVP]" wrote:

Look at the Left, InStr, etc. string functions to do what you want.
--

Ken Snell
MS ACCESS MVP


"JanetF" wrote in message
...
Hello,

I have a first name field in a query that has text in brackets after the
first name. I would like to remove the brackets and the text within the
brackets. How do I go about doing this? Thanks in advance.

Janet



  #10  
Old August 15th, 2005, 09:15 PM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

Sorry...typo:

MyName: Left([FirstName], IIf(InStr([FirstName], "[")=0, Len([FirstName]),
InStr([FirstName], "[")-1))

--

Ken Snell
MS ACCESS MVP

"Ken Snell [MVP]" wrote in message
...
Giving a completely generic answer sometimes is misleading, especially
when one learns (as you have said here) that the original question was not
complete.

Something such as this:

MyName: Left([FirstName], IIf(InStr([FirstName], "[")=0, Len([FirstName],
InStr([FirstName], "[")-1)

--

Ken Snell
MS ACCESS MVP


"JanetF" wrote in message
...
Thanks, but I need a bit more information than that. The text in
brackets is
sometimes there and sometimes not. It can be any imaginable length. I
need
to know how to not include anything in brackets in the query results.
Thanks.

Janet

"Ken Snell [MVP]" wrote:

Look at the Left, InStr, etc. string functions to do what you want.
--

Ken Snell
MS ACCESS MVP


"JanetF" wrote in message
...
Hello,

I have a first name field in a query that has text in brackets after
the
first name. I would like to remove the brackets and the text within
the
brackets. How do I go about doing this? Thanks in advance.

Janet







 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Subforms? AccessRookie Using Forms 7 April 8th, 2005 09:30 AM
Outline Renee Hendershott Page Layout 2 December 25th, 2004 02:49 PM
Complex Query (was: Refresh vs. requery vs. Remove Filter in FormsCoding NG) rgrantz Running & Setting Up Queries 1 November 23rd, 2004 01:59 AM
Union Query Not Returning A Value Jeff G Running & Setting Up Queries 2 October 19th, 2004 05:47 PM
Extract Text Outside of Brackets Frank Kabel Worksheet Functions 2 February 11th, 2004 07:38 AM


All times are GMT +1. The time now is 08:40 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.