Thanks for replying Karl.
Basically on a form I press a button which closes the form and then perfoms the tasks.
See full code below:
Private Sub Command37_Click()
Dim objMsg As MailItem
' Process Raw Material Delivery into SUUS
DoCmd.SetWarnings (WarningsOff)
DoCmd.RunCommand acCmdSaveRecord
DoCmd.Close acForm, "Enter Pallet Qty"
DoCmd.OpenQuery "UpdateRelationFieldSDTT"
DoCmd.OpenQuery "ApdTotalsToMaterialDeliveries"
DoCmd.OpenQuery "MakeTableDeliveryToSR"
DoCmd.OpenQuery "UpdateDeliverySR"
DoCmd.OpenQuery "ApdNewPalletsToBIM_Suus"
DoCmd.Close acForm, "Raw Material Switchboard"
' DoCmd.OpenReport "Pallet Label", acViewNormal, "", "", acNormal
' Create Temporary File
If Len(Dir("c:\Temp", vbDirectory)) = 0 Then
MkDir "c:\Temp"
End If
DoCmd.OutputTo acOutputReport, "Pallet Label", acFormatPDF, "C:\Temp\PalletLabel.pdf", False
DoCmd.OutputTo acOutputQuery, "OutsideStorageDespatchFormXLS", acFormatXLS, "C:\Temp\OutsideStorageDespatchFormXLS.xls", False
I tried commenting out the pdf line but this had the same effect.
The folder Temp is already in the C:\ root. It was working but has suddenly stopped.
I can open the report but the second one is query which I want to put into Excel.