|
-
Mar 20th, 2002, 05:47 PM
#1
Thread Starter
Hyperactive Member
Database Question?
this code read two tables and produce a query recordset linked with INNER JOIN then it pass the query to another table. The problem is that the code read only one record and add only one record, while the tables have many records. I tried with MoveNext, MoveFirst, MoveLast and it does not work. there is something wrong in this code? well, I am new in Visual Basic and I have not experience in coding, may be this code look uncommon for you, but is my first step into programming. If you find the probelm please let me know.
Here is the code:
Private Sub Form_Load()
Dim dbs As Database
Dim rstInvent As Recordset
Dim rstQry As Recordset
Dim rstReceiving As Recordset
Set dbs = OpenDatabase("C:\project\datos.mdb")
Set rstInvent = dbs.OpenRecordset("Inventory")
Set rstReceiving = dbs.OpenRecordset("receiving")
Set rstQry = dbs.OpenRecordset("SELECT ALL " _
& "Receiving.OrderNo, Receiving.VendorName, " _
& "Receiving.DateReceived, RecevItem.ItemNo, " _
& "RecevItem.Description, RecevItem.Price, " _
& "RecevItem.Quantity FROM Receiving " _
& "INNER JOIN RecevItem ON Receiving.RecordID = " _
& "RecevItem.RecordID;")
rstQry.MoveNext
With rstInvent
Do While Not rstQry.EOF
rstInvent.AddNew
!OrderID = rstQry!OrderNo
!SupplierName = rstQry!VendorName
!InventDate = rstQry!DateReceived
!ItemID = rstQry!ItemNo
!ItemName = rstQry!Description
!Price = rstQry!Price
!Quantity = rstQry!Quantity
Text1.Text = rstQry!Price
Text2.Text = rstQry!Quantity
rstInvent.Update
rstInvent.Close
Exit Do
Loop
dbs.Close
End With
End Sub
I really apreciate your BIG HELP
thank you in advance
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|