Adding multiple rows to a form via SQL.

  • Thread starter Thread starter Ian Norris
  • Start date Start date
I

Ian Norris

I have a subform which displays multiple rows which I wish
to populate via SQL.
My select statement returns 13 rows into a recordset. When
I try to insert them into the form it overwrites the first
row with each of the 13 returned records. This leaves me
with just the 13th record displayed in the form.

The code I am using to populate the subform is similar to

Do While Not rs.EOF
With rs
Forms!form!subform!Field1 = !Field1
Forms!form!subform!Field2 = !Field2
rs.MoveNext
End With
Loop
rs.close

Using the debugger I can see all 13 records being loaded
into the first row of the subform. How do I move down the
rows within the subform so that all 13 rows are displayed.

Thanks
Ian Norris
 
Hi,
You can't do this with an unbound form. An Access form in Data sheet view
doesn't work like a grid control.
Just make your select statement the form's recordsource.
 
Back
Top