Solved

Cross Tab Query Export to Excel with Formatting

Posted on 2007-03-21
3
706 Views
Last Modified: 2013-11-27
I have a cross tab query.  I am using the query to allow users to export the data to excel.  With the cross tab, I have 'SOX Control' on the vertical access and 'Project' on the horizontal access.  With the cross tab, I have instances where 1 = True (selected by check box) and 0 = False.

Two things, is it possible to format the data before it is exported to excel, to have 1 = 'X' and 0 = 'N/A'?
The other thing, can I code the query when exported to have all cells that do not contain values (i.e., 1 or 0) to be greyed out in excel?

Thank you
0
Comment
Question by:davidkohne
  • 2
3 Comments
 
LVL 5

Expert Comment

by:Steve Dubyo
ID: 18770114
Hi..

You should be able to export with your replacement values for 1 and 0, can you post your current SQL ?

To gray out certain cells in excel you are probably best to set conditional formatting within excel.
0
 

Author Comment

by:davidkohne
ID: 18771700
This is the only code that I have for the export of the Cross Tab.  I am playing with conditional formatting as we speak.  Thanks,

Private Sub cmdControlOverview_Click()
    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "qry CrossTabSOXControl", "D:\Documents and Settings\All Users\Desktop\SOX 404 Control Log CrossTab Query.xls", -1
End Sub
0
 
LVL 5

Accepted Solution

by:
Steve Dubyo earned 250 total points
ID: 18771859
Sorry, I should have been clearer.  I was asking for the SQL which makes up your query 'qry CrossTabSOXControl', if you open it up in Design View, then from the View menu, select SQL View, then post the code it shows there..

I'm thinking that in Access changing the output of the query would be more straight forward than using ado to change the recordset before exporting.

On the other hand you could do the replacement in Excel with a couple of lines of vba..

    With Range("C1:M100")   'Change to match you range of cells
          .Replace "1", "X"
          .Replace "0", "N/A"
    End With

 
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now