Hi

I have the code below but have problems trying to convert it into one clean update query. Any help would be greatly appreciated. Thanks.

Code:
    Set MyTable = New ADODB.Recordset
    strSQL = "SELECT " & colHdg & ".ID FROM " & _
        "(" & colHdg & " INNER JOIN VoicePPC ON " & colHdg & ".Customer_Index = " & _
        "VoicePPC.CustID) INNER JOIN CustomerVCLI ON (VoicePPC.CLI = CustomerVCLI.CLI) AND " & _
        "(VoicePPC.CustID = CustomerVCLI.CustID) AND (" & colHdg & ".Dialling_Code_Calling = " & _
        ConcatenateFields("CustomerVCLI.NationalDiallingCode", "CustomerVCLI.RegionalDiallingCode") & _
        ") AND (" & colHdg & ".Number_Calling = CustomerVCLI.CLIDetails) WHERE " & _
        "((VoicePPC.CustID = " & custIdx & ") AND (" & colHdg & ".Date_Time_Called >= #" & FormatDateForDB(fromDate, False) & _
        "#) AND (" & colHdg & ".Date_Time_Called <= #" & FormatDateForDB(toDate, False) & "#) AND (" & colHdg & ".Customer_Index = " & custIdx & ") AND " & _
        "(VoicePPC.VoicePricePlan = '" & pPlan & "'))"
    MyTable.Open ModifySQLStatement1(1, strSQL), myMainDbCon, adOpenDynamic, adLockBatchOptimistic, adCmdText
    'debug.print MyTable.RecordCount
    Do Until MyTable.EOF
        DoEvents
        strSQL = "UPDATE " & colHdg & " SET Valid_CLI_For_Plan = 1 WHERE ID = " & MyTable![id]
        myMainDbCon.Execute ModifySQLStatement1(1, strSQL), , adCmdText
        If MyTable.EOF = False Then
            MyTable.MoveNext
        End If
    Loop
    MyTable.Close
    Set MyTable = Nothing