Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496

    I have it working now however

    correction: it saves the last email and emails it to the next if they are blank (retained dim I guess)

    I can't figure out why it doesn't change with the next record...?

    code below:

    Code:
    rs.MoveFirst
    Do Until rs.EOF
    
    
    
    
    
    
    If Me.Frame63 = 1 Then
        If Not IsNothing(rs![1ContactEmail]) Then
        emailofsc = rs![1ContactEmail]
        End If
    ElseIf Me.Frame63 = 2 Then
      If Not IsNothing(rs![6EnglishEmail]) Then
        emailofsc = rs![6EnglishEmail]
        End If
    ElseIf Me.Frame63 = 3 Then
      If Not IsNothing(rs![2LibrarianEmail]) Then
        emailofsc = rs![2LibrarianEmail]
        End If
    ElseIf Me.Frame63 = 4 Then
      If Not IsNothing(rs![4MusicEmail]) Then
        emailofsc = rs![4MusicEmail]
        End If
    ElseIf Me.Frame63 = 5 Then
      If Not IsNothing(rs![3DramaEmail]) Then
        emailofsc = rs![3DramaEmail]
        End If
    ElseIf Me.Frame63 = 6 Then
      If Not IsNothing(rs![5WelfareEmail]) Then
        emailofsc = rs![5WelfareEmail]
        End If
    ElseIf Me.Frame63 = 7 Then
      If Not IsNothing(rs![SchoolEmail]) Then
        emailofsc = rs!SchoolEmail
        End If
    End If
    
    
    DoCmd.SendObject , , , "email@email.com.au", , , emsubject & " " & emailofsc, messagebody, no
    
    
    rs.MoveNext
    
    
    Loop

  2. #17
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    sorry

    fixed

    Code:
    
    
    
    If Me.Frame63 = 1 Then
        If IsNothing(rs![1ContactEmail]) Then
        emailofsc = "noemail"
            Else
        emailofsc = rs![1ContactEmail]
        End If
    ElseIf Me.Frame63 = 2 Then
      If IsNothing(rs![6EnglishEmail]) Then
        emailofsc = "noemail"
        Else
        emailofsc = rs![6EnglishEmail]
        End If
    ElseIf Me.Frame63 = 3 Then
      If IsNothing(rs![2LibrarianEmail]) Then
        emailofsc = "noemail"
        Else
        emailofsc = rs![2LibrarianEmail]
        End If
    ElseIf Me.Frame63 = 4 Then
      If IsNothing(rs![4MusicEmail]) Then
        emailofsc = "noemail"
        Else
        emailofsc = rs![4MusicEmail]
        End If
    ElseIf Me.Frame63 = 5 Then
      If IsNothing(rs![3DramaEmail]) Then
        emailofsc = "noemail"
        Else
        emailofsc = rs![3DramaEmail]
        End If
    ElseIf Me.Frame63 = 6 Then
      If IsNothing(rs![5WelfareEmail]) Then
        emailofsc = "noemail"
        Else
        emailofsc = rs![5WelfareEmail]
        End If
    ElseIf Me.Frame63 = 7 Then
      If IsNothing(rs![SchoolEmail]) Then
        emailofsc = "noemail"
        Else
        emailofsc = rs!SchoolEmail
        
        End If
    End If
    If emailofsc = "noemail" Then
    rs.MoveNext
    Else
    DoCmd.SendObject , , , "email@email.com.au", , , emsubject & " " & emailofsc, messagebody, no
    rs.MoveNext
    End If
    Loop

  3. #18
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Thanks itsme it is doing everything I need it to

  4. #19
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Glad it is working for you. Sometimes when I have multiple options or when using Option Groups I will use a Select Case statement. It can make it a little easier to read, especially if you are going to use an additional, nested, If Then Else.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 08-28-2013, 02:27 AM
  2. Search Query not giving all results
    By wrkadri in forum Queries
    Replies: 5
    Last Post: 02-05-2013, 12:37 AM
  3. Calculation in Query giving wrong results
    By dargo72 in forum Queries
    Replies: 11
    Last Post: 11-07-2012, 05:39 AM
  4. Replies: 3
    Last Post: 07-13-2012, 09:18 AM
  5. Replies: 3
    Last Post: 01-25-2011, 09:50 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
  •  
Other Forums: Microsoft Office Forums