?
Solved

Cross Tab Query Export to Excel with Formatting

Posted on 2007-03-21
3
Medium Priority
?
715 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1000 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

Congratulations! You’re Certified – Now What?

Starting a new career can be overwhelming. Becoming certified in your field of expertise is a great start, but where do you go from here?  Here are some tips to help you on your career journey.

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Suggested Courses

741 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