Results 1 to 3 of 3

Thread: [RESOLVED] [ACCESS 2007] Anyone see anything obiously wrong with this code?

Threaded View

  1. #2
    Fanatic Member dmaruca's Avatar
    Join Date
    May 2006
    Location
    Jacksonville, FL
    Posts
    577

    Re: [ACCESS 2007] Anyone see anything obiously wrong with this code?

    You're probably running into nulls. Try this.

    Code:
    Private Sub btnEMailSecChfs_Click()
    DoCmd.OpenQuery ("qry SECTION CHIEFS")
    
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Dim objSubject As String
    Dim objAllRecip As String
    
    Set db = CurrentDb
    Set rs = db.OpenRecordset("tbl SECTION CHIEFS")
    
    On Error Resume Next
    
    rs.MoveFirst
    objSubject = rs("HookName") & "_" & "Information/Message:"
    
    Do Until rs.EOF
      
    	If Not IsNull(rs![WORK E-MAIL ADDRESS]) And Trim(rs![WORK E-MAIL ADDRESS]) <> "" Then
    		If Len(objAllRecip) > 0 Then objAllRecip = objAllRecip & ";"
    		objAllRecip = objAllRecip & rs![WORK E-MAIL ADDRESS]
    	End If
    	
    	rs.MoveNext
    Loop
    
    Debug.Print (objAllRecip & "3")
    
    DoCmd.SendObject -1, , , objAllRecip, "[email protected]", , objSubject, , -1
    
    rs.Close
    
    End Sub
    Last edited by dmaruca; May 5th, 2011 at 11:18 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width