473,396 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

In Access 2003, how to: output a value, followed by a percent sign (%), from a SQL query on a Report

Hello world:

I'm having trouble finding how to escape the percent sign ("%") from a SQL
query
so that it will show up in an Access report. Here's my SQL string ...

'--Build SQL String
strSQL = ""
strSQL = strSQL & "SELECT tblSubscriberActivity.PERIOD, "
strSQL = strSQL & "Sum(tblSubscriberActivity.AVG_SUBS) AS AVG_SUBS, "
strSQL = strSQL & "Sum(tblSubscriberActivity.NET_DEACTS) AS NET_DEACTS, "
strSQL = strSQL & "CSTR(ROUND(Sum(tblSubscriberActivity.NET_DEAC TS)/"
strSQL = strSQL & "Sum(tblSubscriberActivity.AVG_SUBS),3)*100) AS CHURN "
strSQL = strSQL & "FROM tblSubscriberActivity "
strSQL = strSQL & "GROUP BY tblSubscriberActivity.PERIOD "
strSQL = strSQL & "HAVING tblSubscriberActivity.PERIOD In (" & strPeriod &
");"

The above SQL code works and produces a nice (for example) "5.9" value for
CHURN.
However, if I want it to produce "5.9%", I can't do it. I have tried using
Chr(37), but that
doesn't work. There MUST be a way to do this! Can anyone help?

Alan
Nov 13 '05 #1
1 3763
On Thu, 30 Dec 2004 03:26:57 GMT, "Alan Lane" <aw*****@yahoo.com>
wrote:

Set the Format property for that field in the report to Percent.
Then divide your results by 100, so you get 0.059, which will then
correctly display as 5.9%

-Tom.

Hello world:

I'm having trouble finding how to escape the percent sign ("%") from a SQL
query
so that it will show up in an Access report. Here's my SQL string ...

'--Build SQL String
strSQL = ""
strSQL = strSQL & "SELECT tblSubscriberActivity.PERIOD, "
strSQL = strSQL & "Sum(tblSubscriberActivity.AVG_SUBS) AS AVG_SUBS, "
strSQL = strSQL & "Sum(tblSubscriberActivity.NET_DEACTS) AS NET_DEACTS, "
strSQL = strSQL & "CSTR(ROUND(Sum(tblSubscriberActivity.NET_DEAC TS)/"
strSQL = strSQL & "Sum(tblSubscriberActivity.AVG_SUBS),3)*100) AS CHURN "
strSQL = strSQL & "FROM tblSubscriberActivity "
strSQL = strSQL & "GROUP BY tblSubscriberActivity.PERIOD "
strSQL = strSQL & "HAVING tblSubscriberActivity.PERIOD In (" & strPeriod &
");"

The above SQL code works and produces a nice (for example) "5.9" value for
CHURN.
However, if I want it to produce "5.9%", I can't do it. I have tried using
Chr(37), but that
doesn't work. There MUST be a way to do this! Can anyone help?

Alan


Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Sean C. | last post by:
Helpful folks, Most of my previous experience with DB2 was on s390 mainframe systems and the optimizer on this platform always seemed very predictable and consistent. Since moving to a WinNT/UDB...
3
by: Jon Ole Hedne | last post by:
My Access 2002-application need to work with tables from both Oracle and Access. To solve this, I want to run some querys on three views in Oracle and import the results into temporary...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
8
by: Mike MacSween | last post by:
tblCourses one to many to tblEvents. A course may have an intro workshop (a type of event), a mid course workshop, a final exam. Or any combination. Or something different in the future. At...
52
by: Neil | last post by:
We are running an Access 2000 MDB with a SQL 7 back end. Our network guy is upgrading to Windows Server 2003 and wants to upgrade Office and SQL Server at the same time. We're moving to SQL Server...
14
by: pdavis06 | last post by:
I know that there is a thread about this, but I was unable to add to it; I just joined. The problem is that I do not want to change the date format for the entire database output, merely for a header...
1
by: bobykim | last post by:
Hi All, I'm using MS Access 2003 in a Windows XP environment. I've created an aging report for my department that is based on what I call the "Main query" with an IIf statement that allows the...
23
by: helm | last post by:
Folks, could anyone advise ... Is there a significant difference in crosstab capabilities in Access and Excel? Using Office XP 2002 ... to produce a crosstab report I developed it in Excel from...
5
by: accesstruggle | last post by:
Hello, I am having trouble with my database in Access. The problem lies in my report. I have created a report based off a query. The query contains all values that I'll need for my report- some will...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.