View Full Version : Replace function in a query


RexesOperator
01-19-2008, 08:58 AM
Can the replace function be used in a query?

I have used this

=Replace(Format([SITELATSEC],"00.0"),".",",") in a report and it works fine.

I have the following expression in a query that is output to a report.

LAT: "Latitude: " & [SITELATDEG] & "º " & [SITELATMIN] & "' " & [SITELATSEC] & """ "

I need to be able to display [SITELATSEC] with a comma instead of a decimal point. I tried

LAT: "Latitude: " & [SITELATDEG] & "º " & [SITELATMIN] & "' " & =Replace(Format([SITELATSEC]00.0"),".",",") & """ "

and got an error message about too many commas.

On a more general note: Has anyone ever actually finished a database - ie got to the point where no changes needed to be made? 18 months after this started, and I'm still tryng to accomodate what my manager wants!

WayneRyan
01-19-2008, 03:38 PM
Hopefully, this link will help.

http://www.thescripts.com/forum/thread196294.html

Wayne

EMP
01-19-2008, 03:40 PM
LAT: "Latitude: " & [SITELATDEG] & "º " & [SITELATMIN] & "' " &
=Replace(Format([SITELATSEC]00.0"),".",",") & """ "


In a query, you don't need the = sign and you have left out a comma and a double-quote.

Replace(Format([SITELATSEC],"00.0"),".",",")

^

RexesOperator
01-20-2008, 06:19 AM
Thank you EMP - that works perfectly! Fortunately our office updated to Access 2003 about a year ago (about 6 months after I started this project), and now Replace works in the query (at least what I implemented with EMP's eagle eyes).

Thanks for looking Wayne ..