Error tag show up in Access-to-Excel spreadsheet

projecttoday

Registered User.
Local time
Yesterday, 19:08
Joined
Jan 5, 2011
Messages
51
I am creating an Excel spreadsheet from within Access using VBA code. In some of the resulting numerical cells there is a green triangle in the corner indicating an error. There are numbers (which are correct) in these cells. I would like to get rid of these tags and right-justify the numbers. It doesn't happen all the time. It seems to be happening when the numbers have decimal places. Obviously it has something to do with formatting but Format/Cell/Number within Excel doesn't work so I don't know how to format it even within Excel and I want to format it from Access. To get rid of the tag I have to click on it and select convert to number format. I would like to generate the spreadsheet without these tags. I have tried using the Cint function for fields in the original query that are coming up that way and it didn't work. (The query is used to create a recordset. The recordset is sent to Excel.)

So, I'm thinking either another function in my query or recordset or a statement to format the spreadsheet. Probably something very simple. Anybody know?
 
You might have several options here, one is to set the format to the column before the data is transfered to it, the other might be using the Data to Columns options, and as a final one it might be useful to use a Find and Replace option.

Green triangle means its a text field, so there might be something in there that could be used in the Find and Replace to resolve that. Which you cna record in Excel once the data is there and then look at the code and adapt it to run from Access.
 

Users who are viewing this thread

Back
Top Bottom