I'm running the following code which works great, except for that if more than 1 record is found, it doesn't loop through on the inser into line, always inserts the 1st one
How can I get it to loop through the insert into as well?
thanks
ian
str2 = "SELECT * from qry_temp_weekly where [entrydate] between " & "#" & Format([entry_date], "mm/dd/yy"
& "#" & " AND " & "#" & Format([end_entry_date], "mm/dd/yy"
& "#"
Msgbox str2
Set rst2 = db1.OpenRecordset(str2)
str3 = "INSERT INTO tbltemp (RefNo,entrydate,Function) values ('" & rst2!RefNo & "' ,'" & rst2!entrydate & "','" & rst2!Function & "')"
Msgbox str3
db1.Execute (str3)
rst2.MoveLast
Msgbox rst2.RecordCount
rst2.MoveFirst
Do Until rst2.EOF
rst2.MoveNext
Loop
Msgbox rst2.RecordCount
How can I get it to loop through the insert into as well?
thanks
ian
str2 = "SELECT * from qry_temp_weekly where [entrydate] between " & "#" & Format([entry_date], "mm/dd/yy"
Msgbox str2
Set rst2 = db1.OpenRecordset(str2)
str3 = "INSERT INTO tbltemp (RefNo,entrydate,Function) values ('" & rst2!RefNo & "' ,'" & rst2!entrydate & "','" & rst2!Function & "')"
Msgbox str3
db1.Execute (str3)
rst2.MoveLast
Msgbox rst2.RecordCount
rst2.MoveFirst
Do Until rst2.EOF
rst2.MoveNext
Loop
Msgbox rst2.RecordCount