Code:
Private Sub Comando2_Click()
On Error GoTo errore:
Dim dbs As DAO.Database
Dim qdf As QueryDef
Dim rs As DAO.Recordset
Set dbs = CurrentDb
For Each qdf In CurrentDb.QueryDefs
If (qdf.ReturnsRecords) = True Then
DoCmd.SendObject acSendQuery, qdf.Name, acFormatPDF, pluto@mail.it, , , "obj", "subj"
Else
Debug.Print qdf.Name
End If
Next qdf
Set qdf = Nothing
Set dbs = Nothing
DoCmd.Close qdf.Name
errore:
MsgBox Err.Description & Err.Number, vbInformation, "azione annullata"
Err.Clear
End Sub
What's wrong in this code: i would test query's recordset befor to send email. IF recordset is empty i would not that query
help