W
Wahab
Hi,
I want to write recordset based on query, selected records I want to write
to another table, for that
I open rTarget recordset in that table I wnat to write the records
sellected by query, But it is not working
please help me how i will write this recordset:
Dim StrSQL as String
StrSQL= " SELECT D.InvoiceNo, D.ProductID, D.ItemPrice, D.SaleAmount," & _
" D.SaleCopAmount FROM tCoptInvoices" & _
" INNER JOIN tCoptInvoicesDetails D ON tCoptInvoices.InvoiceNo =
D.InvoiceNo " & _
" WHERE Date Between # " & [Forms]![Startup
Dialog]![BeginningDate] & " # And # " & [Forms]![Startup
Dialog]![EndingDate] & " # "
Set rst = CurrentDb.OpenRecordset(StrSQL)
Set rTarget = CurrentDb.OpenRecordset("tInvoicesDetails")
Do Until rst.EOF
rTarget.AddNew
rTarget!InvoiceNo = rst!InvoiceNo
rTarget!ProductID = rst!ProductID: rTarget!Cartons =
rst!Cartons
rTarget!ItemPrice = rst!ItemPrice: rTarget!SaleAmount
= rst!SaleAmount
rTarget.Update
rst.MoveNext
Loop
rst.Close
I want to write recordset based on query, selected records I want to write
to another table, for that
I open rTarget recordset in that table I wnat to write the records
sellected by query, But it is not working
please help me how i will write this recordset:
Dim StrSQL as String
StrSQL= " SELECT D.InvoiceNo, D.ProductID, D.ItemPrice, D.SaleAmount," & _
" D.SaleCopAmount FROM tCoptInvoices" & _
" INNER JOIN tCoptInvoicesDetails D ON tCoptInvoices.InvoiceNo =
D.InvoiceNo " & _
" WHERE Date Between # " & [Forms]![Startup
Dialog]![BeginningDate] & " # And # " & [Forms]![Startup
Dialog]![EndingDate] & " # "
Set rst = CurrentDb.OpenRecordset(StrSQL)
Set rTarget = CurrentDb.OpenRecordset("tInvoicesDetails")
Do Until rst.EOF
rTarget.AddNew
rTarget!InvoiceNo = rst!InvoiceNo
rTarget!ProductID = rst!ProductID: rTarget!Cartons =
rst!Cartons
rTarget!ItemPrice = rst!ItemPrice: rTarget!SaleAmount
= rst!SaleAmount
rTarget.Update
rst.MoveNext
Loop
rst.Close