hi ,
  
  
I have some code that loops the clone recordset of my subform and generates a email with attachments. I have mainform and continuous subform within the subform I have field called address this holds paths to files and another field called send and this is a yes/no field
  
now what I'm trying to do is loop through the subform if send field is true then attach file from the address path but if send field is false then do not attach file
  
here the code I have
  
 
	
	
	
		
  
thanks in advance
  
shane
 I have some code that loops the clone recordset of my subform and generates a email with attachments. I have mainform and continuous subform within the subform I have field called address this holds paths to files and another field called send and this is a yes/no field
now what I'm trying to do is loop through the subform if send field is true then attach file from the address path but if send field is false then do not attach file
here the code I have
		Code:
	
	
	Dim olApp       As Outlook.Application
    Dim olMail      As Outlook.MailItem
    Dim olAttach    As Outlook.Attachment
    Dim rstAttach   As DAO.Recordset
     
    Set olApp = New Outlook.Application
    Set olMail = olApp.CreateItem(olMailItem)
    
    With Me.attachments_subform.Form
        ' Commit changes (if necessary)
        If .Dirty Then .Dirty = False
        
        ' Fetch your subform's recordset
        Set rstAttach = .RecordsetClone
    End With
    
    ' Compose email, attach docs and send
    With olMail
        .BodyFormat = olFormatHTML
        .To = "[EMAIL="test@test.com"]test@test.com[/EMAIL]"
        .CC = ""
        .Subject = "tests!"
        .Body = "this is a testcode"
        
        ' Add Attachments
         With rstAttach
            If .RecordCount > 0 Then
                .MoveFirst
                Do While Not .EOF
                    strpath = !Address
                    olMail.Attachments.Add strpath, olByValue
                    DoEvents
                    .MoveNext
                Loop
            End If
        End With
        
        .Display
'        .Save
'        .Send
    End With
    
    Set olMail = Nothing
    Set olApp = Nothing
    Set rstAttach = Nothingthanks in advance
shane
 
	

 
 
		
 
 
		 Next time...
 Next time... 
 
		 
 
		 
 
		