Results 1 to 4 of 4
  1. #1
    JJCHCK is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    30

    IsNull


    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

  2. #2
    Rhino373 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    65
    Where does it throw an error? You do need to exit the sub before you get to your error label or it will throw your error message box everytime.

  3. #3
    JJCHCK is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    30
    this line code dosent work "If (qdf.ReturnsRecords) = True Then":
    if the query have no record that goes in attachements in email
    but i would not send blank report in my email
    sorry for english

  4. #4
    JJCHCK is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    30
    i forget: i have report that sometime have records and other time no but i want
    send all my mail without remember this

Please reply to this thread with any new information or opinions.

Similar Threads

  1. dcount and isnull
    By Madmax in forum Access
    Replies: 7
    Last Post: 06-22-2011, 09:31 AM
  2. IsNull not working...
    By Moekandu in forum Programming
    Replies: 3
    Last Post: 01-29-2011, 06:48 PM
  3. Query using IIf(IsNull) expression
    By jmartin in forum Queries
    Replies: 3
    Last Post: 12-18-2009, 04:19 PM
  4. IsNull question
    By Simon Sweet in forum Access
    Replies: 4
    Last Post: 12-22-2007, 04:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums