updating data in a table

  • Thread starter Thread starter Derek
  • Start date Start date
D

Derek

I have a field that contains numbers that have dashes
seprating some of the numbers, sort of like a social
security number. What I need to do is eliminate the
dashes. Is there a quick way to remove the dashes. I
know there is way to add dashes, by using the input mask,
but I can't remove them all at once.

Also, how can I add two digits in the beginning of the
same data set, as well as, adding four digits to the end.
 
Hi,


With Access 2002, you can use Replace directly in the query.
With Access 2000, you have to use a function that will call Replace, and use the VBA function in
the query.


Public Function MyReplace( ByVal Arg1, ByVal Arg2, ByVal Arg3) As String
MyReplace=Replace( Arg1, Arg2, Arg3)
End Function


With 2000 (similar with 2002), you would then Update To:

MyReplace( [FieldNameHere] , "-", "" )


where the third argument is just two double-quotes in sequence.


Sure, always make a backup (copy) before experimentation on "real" data.



Hoping it may help,
Vanderghast, Access MVP
 
Back
Top