Access 2003 to 2010

billmark

Board Regular
Joined
Dec 11, 2011
Messages
59
Hi
I've the following statements in access 2003 and now converted to access 2010. When running this, it prompts the error message (also I've changed excel 2003 to 2010)
'Excel cannot open the file because the file format or file extension is not valid'

Please advise how to fix.

QUOTE
Private Sub selected_clents_by_10_Combinedbyn_Click()
If Me.Xlsxreport = False Then
DoCmd.OpenReport "selected clients by 10 Combined", acViewPreview

Else
DoCmd.OutputTo acOutputReport, "selected clients by 10 Combined", "Microsoft Excel", "C:\Fndsby10Combined.xlsx", True

End If
End Sub
UNQUOTE
Regards
Bill
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Hi
I've the following statements in access 2003 and now converted to access 2010. When running this, it prompts the error message (also I've changed excel 2003 to 2010)
'Excel cannot open the file because the file format or file extension is not valid'

Please advise how to fix.
Code:
Private Sub selected_clents_by_10_Combinedbyn_Click()
If Me.Xlsxreport = False Then
   DoCmd.OpenReport "selected clients by 10 Combined", acViewPreview
  
Else
   DoCmd.OutputTo acOutputReport, "selected clients by 10 Combined", "Microsoft Excel", "C:\Fndsby10Combined.xlsx", True
 
End If
End Sub
Regards
Bill


Bill,

TIP: To add tha code tag click the # button on the left side of the Quote button.


"Microsoft Excel" is the older format. I find it better to use the constant acFormatXLSX . If you must you the text then use "Microsoft Excel Workbook (*.xlsx)"


To upgrade the code to the new XLS foramt try:
Code:
Private Sub selected_clents_by_10_Combinedbyn_Click()
If Me.Xlsxreport = False Then
   DoCmd.OpenReport "selected clients by 10 Combined", acViewPreview
  
Else
   DoCmd.OutputTo acOutputReport, "selected clients by 10 Combined", acFormatXLSX, "C:\Fndsby10Combined.xlsx", True
 
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,221,831
Messages
6,162,252
Members
451,757
Latest member
iours

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top