Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8259035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:45:22+00:00 2026-06-08T02:45:22+00:00

I have a access query as below : select column_date, sum(qty1), sum(qty2), sum(qty3) from

  • 0

I have a access query as below :

select column_date, sum(qty1), sum(qty2), sum(qty3) from table1
where column_date = [enter date]
group by column_date
union all
select 'Total' as column_date, sum(qty1), sum(qty2), sum(qty3) from table1
where column_date = [enter date]

Now I have asp code as below :

<%
Dim enterdate = Request.Form("enterdate")
set conn=Server.CreateObject("ADODB.Connection")
conn.open "odbcdatasourcename"
set rs = Server.CreateObject("ADODB.recordset")
sql="abovequery '" & enterdate & "' "
rs.Open sql, conn
%>
<table border="1" width="100%">
<%If rs.EOF then
Response.write ("<center>" & "<b>" & "There is no records for 
the selected dates" & "</b>" & "</center>")%>
<%Else%>
<tr>
<%for each x in rs.Fields
response.write("<th>" & x.name & "</th>")
next%>
</tr>
<%do while not rs.EOF%>
<tr>
<%for each x in rs.Fields%>
<td><%Response.Write(x.value)%></td>
<%next
 rs.MoveNext%>
</tr>
<%loop%>
<%End if%>
<%rs.close
conn.close%>

As you can see I have written it should display message “There is no records for the selected dates” when there is no data for the selected date.
But it still displays only last row with “Total” every time there is no record i.e. second query with blank values. Is it possible to fix it?

And I want to make “bold” last row i.e. Total row when there is record in database for selected date. Is it possible too here? Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T02:45:23+00:00Added an answer on June 8, 2026 at 2:45 am

    You have two queries and should run them as such, first the query to get the data and then the query to get the total. The query as it stands will always return one row with Total as the date.

    This is true even when the table is completely empty. You can check this by creating a table with one column called ID and no rows.

    SELECT ID,ID As ASum
    FROM EmptyTable
    UNION
    SELECT "Total" As ID, Sum(ID)
    FROM EmptyTable
    

    It will return one row.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query in access like below select field1, column_date, sum(qty) from table
I have an SQL query: SELECT ShipVia, SUM(Freight) FROM Orders GROUP BY ShipVia which
I have the following Access query: SELECT [city] FROM [patient] WHERE REPLACE([patient].[city],' ',' ')
Here is a sample access query which I have(query ref/name - abovequery) select column_date,
I have a query being created using OLEDB from access and need to get
How do I specify a date range in MS Access? Is the below query
I have a query that selects a registration date of a user from one
I have a query similar to this: SELECT itemID FROM itemTable WHERE itemID LIKE
I have the below query in access 2007 which gave me correct results using
I have the following Access 2002 query I'm running through OLE DB in .NET:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.