How can you delete dashes(hyphens) in a text field i.e T-123-123-.

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

Guest

How can you delete hyphens (dashes) in a text field. i.e. T-123-123-123-123
I need the (-) removed
 
newatthis9855 said:
How can you delete hyphens (dashes) in a text field. i.e.
T-123-123-123-123 I need the (-) removed

At what stage of processing do you want to do this? Do you have a table
with existing data in the field that you want to fix? You can open the
table, select the column, and press Ctrl+H (or use menu item Edit ->
Replace...) to open the Find and Replace dialog. Then you'd set the
options to search any part of the field, and replace the "-" with
nothing (leaving the "Replace with" box blank.

If you want to remove the dashes from the user's entry, at the time they
enter the text in a text box on a form, you can set an event procedure
for the text box's AfterUpdate event, using the built-in Replace
function (in Access 2000 or later) to do it:

Private Sub txtSomeField_AfterUpdate()

With Me.txtSomeField
If Not IsNull(.Value) Then
.Value = Replace(.Value, "-", "")
End If
End With

End Sub
 
How can you delete dashes in an update/maketable query? The same situation,
but I need to remove them in a query so that I can compair a hyphenated
number with a non-hyphenated number in another much larger database.
 
Assuming Access 2000 or later ...

UPDATE tblTest SET tblTest.TestText = Replace([TestText],"-","");

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Brendan Reynolds said:
Assuming Access 2000 or later ...

UPDATE tblTest SET tblTest.TestText = Replace([TestText],"-","");

Be aware, though, that the original release of Access 2000 couldn't use
the Replace() function directly in a query. That was fixed in one of
the service packs.
 
Thanks Brendan, I am using Access 2003. I will give this a try. I hope you
have a wonderful New Year!

David

Brendan Reynolds said:
Assuming Access 2000 or later ...

UPDATE tblTest SET tblTest.TestText = Replace([TestText],"-","");

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


David Garhart said:
How can you delete dashes in an update/maketable query? The same
situation,
but I need to remove them in a query so that I can compair a hyphenated
number with a non-hyphenated number in another much larger database.
 
Thanks a bunch!!!

David Garhart said:
How can you delete dashes in an update/maketable query? The same situation,
but I need to remove them in a query so that I can compair a hyphenated
number with a non-hyphenated number in another much larger database.
 
Thanks a bunch!!!

Dirk Goldgar said:
Brendan Reynolds said:
Assuming Access 2000 or later ...

UPDATE tblTest SET tblTest.TestText = Replace([TestText],"-","");

Be aware, though, that the original release of Access 2000 couldn't use
the Replace() function directly in a query. That was fixed in one of
the service packs.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Back
Top