Matt Brown
Registered User.
- Local time
- Today, 21:17
- Joined
- Jun 5, 2000
- Messages
- 120
I have the following code in a continuous form.
What i would like the form to do is loop through and display all of the records on the form.
As you can see i have placed a loop in the code thinking that this would then display all of the records in the recordset, but it still only pulls out one.
What am i actually missing to acheive this?
Thanks
Matt
What i would like the form to do is loop through and display all of the records on the form.
As you can see i have placed a loop in the code thinking that this would then display all of the records in the recordset, but it still only pulls out one.
What am i actually missing to acheive this?
Thanks
Matt
Code:
Private Sub Command11_Click()
Dim db1 As DAO.Database
Dim rs1 As DAO.Recordset
Dim SQL As String
Set db1 = CurrentDb()
Select Case Me.Frame2
Case 1
SQL = _
"SELECT tblCustomerXRefComponents.[Part No], tblCustomerXRefComponents.[Component Part No]," & _
"tblCustomerXRefDescription.Description1, tblCustomerXRefDescription.Description2, " & _
"tblCustomerXRefSuppliers.[Approved Supplier]" & _
"FROM (tblCustomerXRefSuppliers INNER JOIN tblCustomerXRefDescription ON tblCustomerXRefSuppliers.[Component Part No] = tblCustomerXRefDescription.[Component Part No]) INNER JOIN tblCustomerXRefComponents ON tblCustomerXRefDescription.[Component Part No] = tblCustomerXRefComponents.[Component Part No]" & _
"WHERE tblCustomerXRefDescription.[Component Part No] = '" & txtbxSearchCriteria & "' "
Set rs1 = db1.OpenRecordset(SQL, dbOpenSnapshot)
With rs1
.MoveFirst
Do Until .EOF
txtbxComponentPartNo = rs1.Fields("[Component Part No]")
txtbxComponentDesc1 = rs1.Fields("[Description1]")
txtbxComponentDesc1 = rs1.Fields("[Description2]")
txtbxComponentApprovedSupp = rs1.Fields("[Approved Supplier]")
.MoveNext
Loop
End With
rs1.Close
End Select
End Sub