URGENT-delete few characters in a field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Everyone,

In my table I have a field named Short_Description and in this field
contains various part numbers...example...6312-2RS(D), 1630-DCG(C),
SSR-10-DD(NX)...

I need to remove the characters in the paranthesis including the
paranthesis. I know there has to be an easier way to do this other than a
"Find and Replace" in the actual table...

Your help is greatly appreciated
 
How easy depends on the structure of your data. Can anything ever
follow the closing parenthesis? If not, just use InStr() to locate the
first one. You then know how many charaters of good stuff you have, and
you can extract them via the Left$() function.

If you need to change, e.g., "6312-2RS(D)-82(C)" to "6312-2RS-82",
you're probably stuck with writing your own function in a Module, using
VBA. (At least, I don't know of any standard Access function to do
this.) It won't take a heck of a lot of code to do this (I'm guessing
maybe 15-20 lines) but could be tricky if you've never written VBA code
before.

Having defined the function you want to use, I would recommend a
multi-step procedure:
- Back up your database. :-)
- Copy the [Short_Description] field in Table Design View, giving the
copy a short, convenient name such as [SD2]
- Use an Update Query to stuff the value from [Short_Description], as
modified by your function, into [SD2].
- Delete [Short_Description], if you have no further use for it.
- Rename [SD2] to [Short_Description].

-- Vincent Johns <[email protected]>
Please feel free to quote anything I say here.
 
The following will extract everything before the ( . Change Crystal to the
actual table name. Before using it as part of an update query, make sure to
back up the table if not the entire database.

SELECT Left([Short_Description],InStr([Short_Description],"(")-1) AS ShortDesc
FROM Crystal
WHERE (((InStr([Short_Description],"("))>0));
 
Vincent,
You'll have to excuse me but I'm still pretty new at this...There isn't
anything that follows the closing ( ). Could you show me how to use the
InStr() and the Left$()?

Thanks

Vincent Johns said:
How easy depends on the structure of your data. Can anything ever
follow the closing parenthesis? If not, just use InStr() to locate the
first one. You then know how many charaters of good stuff you have, and
you can extract them via the Left$() function.

If you need to change, e.g., "6312-2RS(D)-82(C)" to "6312-2RS-82",
you're probably stuck with writing your own function in a Module, using
VBA. (At least, I don't know of any standard Access function to do
this.) It won't take a heck of a lot of code to do this (I'm guessing
maybe 15-20 lines) but could be tricky if you've never written VBA code
before.

Having defined the function you want to use, I would recommend a
multi-step procedure:
- Back up your database. :-)
- Copy the [Short_Description] field in Table Design View, giving the
copy a short, convenient name such as [SD2]
- Use an Update Query to stuff the value from [Short_Description], as
modified by your function, into [SD2].
- Delete [Short_Description], if you have no further use for it.
- Rename [SD2] to [Short_Description].

-- Vincent Johns <[email protected]>
Please feel free to quote anything I say here.

Hi Everyone,

In my table I have a field named Short_Description and in this field
contains various part numbers...example...6312-2RS(D), 1630-DCG(C),
SSR-10-DD(NX)...

I need to remove the characters in the paranthesis including the
paranthesis. I know there has to be an easier way to do this other than a
"Find and Replace" in the actual table...

Your help is greatly appreciated
 
Jerry Whittle's solution (in another message) ought to work pretty well
for you, since we don't have to worry about multiple parentheses.

-- Vincent Johns <[email protected]>
Please feel free to quote anything I say here.
Vincent,
You'll have to excuse me but I'm still pretty new at this...There isn't
anything that follows the closing ( ). Could you show me how to use the
InStr() and the Left$()?

Thanks

:

How easy depends on the structure of your data. Can anything ever
follow the closing parenthesis? If not, just use InStr() to locate the
first one. You then know how many charaters of good stuff you have, and
you can extract them via the Left$() function.

If you need to change, e.g., "6312-2RS(D)-82(C)" to "6312-2RS-82",
you're probably stuck with writing your own function in a Module, using
VBA. (At least, I don't know of any standard Access function to do
this.) It won't take a heck of a lot of code to do this (I'm guessing
maybe 15-20 lines) but could be tricky if you've never written VBA code
before.

Having defined the function you want to use, I would recommend a
multi-step procedure:
- Back up your database. :-)
- Copy the [Short_Description] field in Table Design View, giving the
copy a short, convenient name such as [SD2]
- Use an Update Query to stuff the value from [Short_Description], as
modified by your function, into [SD2].
- Delete [Short_Description], if you have no further use for it.
- Rename [SD2] to [Short_Description].

-- Vincent Johns <[email protected]>
Please feel free to quote anything I say here.


Crystal wrote:

Hi Everyone,

In my table I have a field named Short_Description and in this field
contains various part numbers...example...6312-2RS(D), 1630-DCG(C),
SSR-10-DD(NX)...

I need to remove the characters in the paranthesis including the
paranthesis. I know there has to be an easier way to do this other than a
"Find and Replace" in the actual table...

Your help is greatly appreciated
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top