Format Numbers in Query Text Field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • doma23
    New Member
    • May 2010
    • 107

    #1

    Format Numbers in Query Text Field

    I have a field in a query that contains numbers and text (text field):
    Code:
    C/R: IIf([Revenues]<=0;"n/m";[Costs]/[Revenues])
    I need to export this query to Excel in a number format, so I can easily manipulate the data later.
    If I put null instead of "n/m" it works nicely because it remains the number format, but I need to automatize my application, so I need to have "n/m" in these fields.

    I know it can be done with Excel Automation, but it's rather complicated, is there any other way?
  • jimatqsi
    Moderator Top Contributor
    • Oct 2006
    • 1293

    #2
    Originally posted by doma23
    I have a field in a query that contains numbers and text (text field):
    Code:
    C/R: IIf([Revenues]<=0;"n/m";[Costs]/[Revenues])
    I need to export this query to Excel in a number format, so I can easily manipulate the data later.
    If I put null instead of "n/m" it works nicely because it remains the number format, but I need to automatize my application, so I need to have "n/m" in these fields.

    I know it can be done with Excel Automation, but it's rather complicated, is there any other way?
    I did something like this recently. I think the solution for me was to put some code in Access to format the cell after I knew what the value was. There was something less than spectacular about the result, I forget now exactly what ... I think it had something to do with the the Excel sheet launching automatically and being locked for update until I closed the Access program. But I found I could apply format changes to each cell, so I was happy.

    Jim

    Comment

    Working...