supermaestro
Programmer
Hi
I'm getting errors on the INSERT part of this query in the WHILE loop (data type error) Would appreciate any help...
Private Sub Update_Click()
Dim rs As New ADODB.Recordset
Set rs = CurrentProject.Connection.Execute("SELECT contacts.[Contact ID], transactions.[Transaction ID], transactions.[Last Transaction], transactions.[Transaction Date], transactions.[Transaction Note], transactions.[Next Action Date], transactions.[Next Transaction] FROM contacts INNER JOIN transactions ON contacts.[Contact ID] = transactions.[Contact ID] WHERE transactions.[Next Action Date]=Date() AND transactions.[Next Transaction]='Mailshot';"
Do While Not rs.EOF
CurrentProject.Connection.Execute ("INSERT into transactions ([Contact ID],[Last Transaction],[Transaction Date],[Transaction Note],[Next Action Date],[Next Transaction]) values ('" & rs("Contact ID" & "','Mailshot',Now(),'" & Transaction_Notes & "','" & Next_Action_Date & "','Call');"
rs.MoveNext
Loop
rs.Close
Cheers
I'm getting errors on the INSERT part of this query in the WHILE loop (data type error) Would appreciate any help...
Private Sub Update_Click()
Dim rs As New ADODB.Recordset
Set rs = CurrentProject.Connection.Execute("SELECT contacts.[Contact ID], transactions.[Transaction ID], transactions.[Last Transaction], transactions.[Transaction Date], transactions.[Transaction Note], transactions.[Next Action Date], transactions.[Next Transaction] FROM contacts INNER JOIN transactions ON contacts.[Contact ID] = transactions.[Contact ID] WHERE transactions.[Next Action Date]=Date() AND transactions.[Next Transaction]='Mailshot';"
Do While Not rs.EOF
CurrentProject.Connection.Execute ("INSERT into transactions ([Contact ID],[Last Transaction],[Transaction Date],[Transaction Note],[Next Action Date],[Next Transaction]) values ('" & rs("Contact ID" & "','Mailshot',Now(),'" & Transaction_Notes & "','" & Next_Action_Date & "','Call');"
rs.MoveNext
Loop
rs.Close
Cheers