presence76
Board Regular
- Joined
- May 11, 2004
- Messages
- 76
I am trying to take an Access table and export it to a spreadsheet that I am building with access. The code goes like this:
Function fcnRunBalancing()
BalanceDate = Forms![frmDailyBalancingOptions]![txtBalanceDate].Value
FileDate = FORMAT(BalanceDate, "YYYYMMDD")
Set xlapp = New excel.Application
xlapp.Visible = True
xlapp.Application.ScreenUpdating = False
xlapp.Application.DisplayAlerts = False
xlapp.Workbooks.Open "C:\Documents and Settings\jb83160\My Documents\my PI reports\testing\PI report" & ".xls"
xlapp.ActiveWorkbook.SaveAs filename:="C:\Documents and Settings\jb83160\My Documents\my PI reports\testing\529-" & FileDate & ".xls", _
FileFormat:=xlExcel9795, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel3, "tblPIfinal", "C:\Documents and Settings\jb83160\My Documents\my PI reports\testing\529-" & FileDate & ".xls"
xlapp.ActiveWorkbook.SaveAs filename:="C:\Documents and Settings\jb83160\My Documents\my PI reports\testing\529-" & FileDate & ".xls", _
FileFormat:=xlExcel9795, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
xlapp.ActiveWorkbook.Close
xlapp.Quit
First, I save an existing spreadsheet which I am using as a template. It has tabs named "PIfinal", "tracer" and "balancing". In this process, I am trying to take the PIfinal table that I have already created and load it ot the PIfinal tab of the spreadsheet. When I execute the transferspreadsheet command I get
Run-time error '3422'
cannot modify table structure
another user has the table open.
Any help would be greatly appreciated.
Function fcnRunBalancing()
BalanceDate = Forms![frmDailyBalancingOptions]![txtBalanceDate].Value
FileDate = FORMAT(BalanceDate, "YYYYMMDD")
Set xlapp = New excel.Application
xlapp.Visible = True
xlapp.Application.ScreenUpdating = False
xlapp.Application.DisplayAlerts = False
xlapp.Workbooks.Open "C:\Documents and Settings\jb83160\My Documents\my PI reports\testing\PI report" & ".xls"
xlapp.ActiveWorkbook.SaveAs filename:="C:\Documents and Settings\jb83160\My Documents\my PI reports\testing\529-" & FileDate & ".xls", _
FileFormat:=xlExcel9795, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel3, "tblPIfinal", "C:\Documents and Settings\jb83160\My Documents\my PI reports\testing\529-" & FileDate & ".xls"
xlapp.ActiveWorkbook.SaveAs filename:="C:\Documents and Settings\jb83160\My Documents\my PI reports\testing\529-" & FileDate & ".xls", _
FileFormat:=xlExcel9795, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
xlapp.ActiveWorkbook.Close
xlapp.Quit
First, I save an existing spreadsheet which I am using as a template. It has tabs named "PIfinal", "tracer" and "balancing". In this process, I am trying to take the PIfinal table that I have already created and load it ot the PIfinal tab of the spreadsheet. When I execute the transferspreadsheet command I get
Run-time error '3422'
cannot modify table structure
another user has the table open.
Any help would be greatly appreciated.