Adding multiple rows to a form via SQL.

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
 
D

Dan Artuso

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top