VBA Access, working with recordset

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TravelingCat
    New Member
    • Feb 2010
    • 82

    VBA Access, working with recordset

    Hi,
    My program contains events, each event has several assignments (displayed on the same form, in a subform).
    Each assignment has a checkbox, it's checked to send mail to "assignInCharge " to notify him about the assignment.
    Also i have a checkbox "assignIsSe nt", which is supposed to be checked automatically after sending the first email
    (when it's checked, it means the message will be a reminder). Here's the code:

    Code:
    Set rs = CurrentDb.OpenRecordset("SELECT assignInCharge, workerEmail, assignNum, assignDescription FROM tblAssignments, tblWorkers WHERE assignInCharge = workerNum AND assignSend = -1 AND assignNum = assignNum AND eventNum = " & strEventNum)
       
         Do While Not rs.EOF
               If assignIsSent = False Then
                    If rs(1) & "" <> "" Then
                                'send first notification
                    DoCmd.SendObject acSendNoObject, , , rs(1), , , "Hi, u've got an assignment " & rs(2) & " " & rs(3) & " as part of event " & strEventNum & " " & strEventDescription, strFilePath & "open_app.bat", False
                    End If
    ......
    The mail is sent ok and with the correct parameters, so rs works ok. But the question is,
    how do i make this code reference only that specific assignment which i'm sending the mail about?
    For instance, event 8 has 3 assignments. I choose the third one and check the checkbox.
    But my condition " If assignIsSent = False Then" refers to the first assignment out of three existing, it doesn't know that i'm refering to the third line in the subform... How do i make him know that?
    Sorry for the length.. i hope you understood my question.
    Would appreciate any help, thanks
Working...