Max Wanadoo
max.wanadoo at gmail.com
Sun Jul 5 08:04:39 CDT 2009
test Max -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller Sent: 05 July 2009 10:55 To: Access Developers discussion and problem solving Subject: Re: [AccessD] Calculate Quartile It's a teeny bit more complicated than that, Max, but you set me to thinking. Here is my little test program and two functions, the first of which does it call by call and the second does it all in one line, using nested calls. <vba> Option Compare Database Option Explicit Sub Test() Dim x As String, y As String, z As String x = "123.456.789,12" Debug.Print x y = SwapComma(x) Debug.Print y z = SwapComma2(x) 'do it all in one call Debug.Print z End Sub Function SwapComma(x As String) x = Replace(x, ",", "%") Debug.Print x x = Replace(x, ".", ",") Debug.Print x x = Replace(x, "%", ".") Debug.Print x SwapComma = x End Function Function SwapComma2(x As String) ' not for the faint at heart SwapComma2 = Replace(Replace(Replace(x, ",", "%"), ".", ","), "%", ".") End Function </vba> Which solves the problem as posed, but makes no attempt to understand the wisdom behind Microsoft's lack of a universal representation. hth, Arthur -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com