Results 1 to 4 of 4
  1. #1
    asmores is offline Novice
    Windows 2K Access 2003
    Join Date
    Mar 2013
    Posts
    20

    Union Query to Subtotal

    I've built a union query to work as a means to subtotal. When I export the data to excel all my non-subtotalled columns are coming up as text values rather than numbers. Does anyone know how to convert them to a number again?
    Thank you

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    I am not sure how you are exporting. It may be easiest to export to an existing Excel file that is formatted appropriately. Another approach would be to use VBA to automate the export and format the necessary cells at the time of export.

  3. #3
    asmores is offline Novice
    Windows 2K Access 2003
    Join Date
    Mar 2013
    Posts
    20
    Im using RecordsetClone to copy the query results out and moving them to a new excel sheet. And I am using a range to format the data into a number (objXLS.Columns("f:g").NumberFormat = "$#,##0") but it will not format the "text" as a number, I assume its due to the blanks in the subtotal line forcing the text, but I am not aware of a workaround for this.
    Thank you,

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    I am not great with Excel VBA but your format thing looks like it should work. Perhaps you can use an IIf() function within your query to assign a zero value to Null's.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Query Subtotal
    By bgwool in forum Queries
    Replies: 2
    Last Post: 05-08-2014, 04:30 PM
  2. Create Subtotal in Access 2010 Query
    By alcharbonneau in forum Queries
    Replies: 8
    Last Post: 03-13-2013, 12:52 PM
  3. Replies: 8
    Last Post: 10-22-2012, 07:43 PM
  4. Subtotal on Query
    By claysea in forum Queries
    Replies: 1
    Last Post: 02-17-2012, 10:56 AM
  5. Replies: 1
    Last Post: 02-13-2012, 04:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums