Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 23rd, 2006, 11:25 AM
Registered User
 
Join Date: Dec 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Prefix Data

I am querying a linked table and saving the results in a new table. One of the columns is mobile number. I need to remove the zero at the start of the number and insert +44. I am having no luck, any suggestions.....

 
Old December 26th, 2006, 08:21 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Do an update query first.

Here is what I did: Created Table1 with Column Num, which is TEXT, which I am assuming you have used. Then created an Update Query1 with this SQL code:

UPDATE Table1 SET Table1.Num = "+44" & Right([Num],(Len([Num]-1)))
WHERE (((Table1.Num) Like "0*"));

This uses a regular expression to add "+44" to the beginning of the old string, minus the 1 character to the left, but only acts on records where the one character to the left is "0".

Did this help?
(Back up your table first.)


mmcdonal
 
Old December 26th, 2006, 06:10 PM
Registered User
 
Join Date: Dec 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks alot. That workd a treat.

Thanks again.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove namespace prefix from XmlBean ratzko BOOK: Professional Java Development with the Spring Framework 0 August 10th, 2008 01:23 PM
How a additional prefix in a namespace comes? diang BOOK: ASP.NET Website Programming Problem-Design-Solution 0 July 13th, 2006 10:40 PM
Prefix zero conditionally: A newbie question soorya Access VBA 2 October 18th, 2004 12:17 PM
attribute namespace prefix tsmith XSLT 1 August 12th, 2004 06:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.