Does anyone know what the code is to fill a form's recordset?
I have an unbound form at the moment, and I would like to populate the form's recordset by copying data from an ADODB.recordset.
Private Sub Command1_Click()
Dim rst As New ADODB.Recordset
rst.ActiveConnection = CurrentProject.Connection
rst.CursorType = adOpenKeyset
' Retrieve ID's that start with 1
rst.Open "SELECT * FROM tData WHERE left(ID,1)=1"
Dim frm As Form
Set frm = Forms![fTest]![fTest_Sub].Form
' Populate form textboxes with recordset data
Do Until rst.EOF
!ID = rst("ID")
!PartNumber = rst("PartNumber")
!Description = rst("Description")
--- [ Need code here that will insert new row for next loop ] ---
Set rst = Nothing
I'm using this approach because this will act as a filter to allow a user to retrieve a specificied set of records.