Answer the question
In order to leave comments, you need to log in
Why doesn't DoCmd.OutputTo close files in Access?
I ran into an interesting problem. When using DoCmd.OutputTo to export from Access to Excel, everything works fine, but after that the generated Excel files remain as if they were open. Those. the export was successful, but third-party programs cannot use them, because. these files seem to remain open. At the same time, if you open the file through Explorer, click "Save" and close, they become normal.
Set sklad = CurrentDb.OpenRecordset(StrSQL)
If sklad.RecordCount > 0 Then
With sklad
For i = 1 To .RecordCount
uPrais = !IP
strOutputFile = "C:\" & !NP & ".xls"
DoCmd.OutputTo acOutputQuery, "table_excel", "Excel97-Excel2003Workbook(*.xls)",
strOutputFile, False, "", 0, acExportQualityPrint
.MoveNext
Next i
.Close
End With
End If
Set sklad = Nothing
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question