UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Changing Characters    
 
   
RowleyD
post Jan 19 2006, 01:30 PM
Post #1

UtterAccess Enthusiast
Posts: 99



I am running a query on Sales for a given period. We changed some of our part #s this year, because we changed the net weight of the product. However, I would still like to group them together. In order to do this, I want to change the old part # to the new part#. For example I want to change 222B24AB01 to 228B24AB01.
All that has changed is the thrid character.

I want to use an IIF expression like IIF(ItemNum Like 222*,,ItemNum), but I don't know what to put in the If True section to change the third character.

Any Ideas?

Thanks in advance.
Go to the top of the page
 
+
freakazeud
post Jan 19 2006, 01:38 PM
Post #2

UtterAccess VIP
Posts: 31,413
From: NC, USA



Hi,
use:

=Replace([YourField], "2", "8", 3, 1)

HTH
Good luck
Go to the top of the page
 
+
datAdrenaline
post Jan 19 2006, 01:38 PM
Post #3

UtterAccess Editor
Posts: 15,965
From: Northern Virginia, USA



Do you want to change the part numbers permanantly? ... If YES then use an udate query with SQL text similar to ...

UPDATE tblMyPartNumbers SET PartNumber = Left(PartNumber, 2) & "8" & Mid(PartNumber,4) WHERE Left(PartNumber,3) = "222"

EDITS ADDED:

You could also use Freaks function instead of my concatenation.

Edited by: datAdrenaline on Thu Jan 19 13:40:03 EST 2006.
Go to the top of the page
 
+
RowleyD
post Jan 19 2006, 01:43 PM
Post #4

UtterAccess Enthusiast
Posts: 99



Thanks to both of you. I don't want to change them permantly. I am running a query from an ODBC datasourse (Microsoft Navision), so the Item numbers are hardwired in there. I just want to total them together for inventory planning purposes.

Thanks again.
Go to the top of the page
 
+
RowleyD
post Jan 19 2006, 02:20 PM
Post #5

UtterAccess Enthusiast
Posts: 99



Whoops. For some reason the Replace Function is removing the first 2 characters. It does replace the third character though.

Item: IIf([ItemNum] Like "222*",Replace([ItemNum],"2","8",3,1),[ItemNum])
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th May 2013 - 07:25 AM