Subtraction of 2 (texts) fields.

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

Guest

I have 2 fields, one contaning the address and the other containg the same
address plus the phone number.
I would like to subtract the second field from the first so to obtain a
field with only the phone number.
Thank you in advance.
Mansoor
 
SELECT Trim(Mid([Carriers2]![CarrierNamePhone],
Len([Carriers2]![CarrierName])+1)) AS [ThePhone]
FROM Carriers2;

If the number of characters in the phone numbers were consistant, you could
just use the Mid or Right functions with the proper Start argument to extract
the phone number more simply than above.
 
I have 2 fields, one contaning the address and the other containg the same
address plus the phone number.
I would like to subtract the second field from the first so to obtain a
field with only the phone number.

As this is a mere one-off data scrubbing exercise, what about something
quick and dirty:

SELECT Replace(address_plus_phone, address, CHR(0))
FROM NeedsScrubbing;

You may also need to remove the delimiter between address and phone
e.g. Trim$() may do the trick if it is space characters.

Jamie.

--
 
Dear Mr Jerry Whittle
I thank you very much for your help.
It works perfectly.
I confess that I was reluctant to put the problem, thinking there was no
solution, but now I realize there is no limit for the solutions of all
problems.
Thank you again
Mansoor

Jerry Whittle said:
SELECT Trim(Mid([Carriers2]![CarrierNamePhone],
Len([Carriers2]![CarrierName])+1)) AS [ThePhone]
FROM Carriers2;

If the number of characters in the phone numbers were consistant, you could
just use the Mid or Right functions with the proper Start argument to extract
the phone number more simply than above.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


Mansoor said:
I have 2 fields, one contaning the address and the other containg the same
address plus the phone number.
I would like to subtract the second field from the first so to obtain a
field with only the phone number.
Thank you in advance.
Mansoor
 
Back
Top