Solved

Cross Tab Query Export to Excel with Formatting

Posted on 2007-03-21
3
708 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

929 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

13 Experts available now in Live!

Get 1:1 Help Now