Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Decimal places on export to excel

Status
Not open for further replies.

handlebarry

Technical User
Dec 21, 2004
118
GB
Having a problem exporting a report to excel, the report contains a number field.

When exporting to excel the number field is given two decimal places (12345.00)

Have spent ages trying to solve this, do not want to convert it to text field or insert a "'" into the field.

Anyone know a solution?
Thanks in advance
 
Hi
I am having a little problem with your query. How many decimal places is the number supposed to have? How are you outputting the report? I have tried a report output with both integer and double fields; from code and from Office Links. Every time I have got the correct number of decimals. [ponder]
 
I'm glad to hear that because maybe I can get this resolved.

The number is supposed to have no decimal places, it's a 13 digit reference number (1100500050020). In the table the field size is double, format fixed and decimal places set to zero. On export is appears 1100500050020.00

The report is exported with:

Private Sub cmdExportReport_Click()
On Error GoTo Err_cmdExportReport_Click

Dim stDocName, stFileName As String

stDocName = "Block Report (Export)"
stFileName = "BlockReport"

DoCmd.OutputTo acReport, stDocName, acFormatXLS,
stFileName & ".xls"

Dim Response
Response = MsgBox("Report saved to " & stFileName
& ".xls. Open report?", 36, "Report Exported")
If Response = vbYes Then
Dim RetVal
RetVal = Shell("EXCEL " & stFileName, 1)
Else
End If

Exit_cmdExportReport_Click:
Exit Sub

Err_cmdExportReport_Click:
MsgBox Err.Description
Resume Exit_cmdExportReport_Click

End Sub

The text field in the report is again fixed with decimal places set to zero. Also in the query behind the report the field if fixed with zero decimal points.

Thanks for looking at this
p.s. what is office links?
 
Hi
I am pretty sure it is the format fixed that is causing the problem, because I have replicated it using format fixed on a double field that previously worked fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top