populate form with data

R

Richard

Hi

I am trying to populate a continuous form with data from a recordset. What I
am getting now is only one record.

Appreciate if anyone can modify the code for me.

Thanks in advance

Richard

Code:

Private Sub Form_Load()
Dim DB As DAO.database
Dim rs As DAO.Recordset


Set DB = CurrentDb
Set rs = DB.OpenRecordset("Select A.firstname, A.lastname from wbdata as A")

With rs
If Not (.BOF And .EOF) Then
.MoveFirst

Do Until .EOF
Me.txtFirstname = !FIRSTNAME
Me.txtLastname = !LASTNAME

.MoveNext
Loop

rs.Close
Set rs = Nothing
Set DB = Nothing
End If
End With
End Sub
 
G

Gerald Stanley

Unbound text boxes do not work well within continuous
forms. A neater solution would be to make the
OpenRecordset sql a query, make the query the RecordSource
of the form and make the text boxes bound controls.

Hope That Helps

Gerald Stanley MCSD
 
?

___

Make a query based on the table, then use the query as the recordsource
for the form.

HTH
 
R

Richard

Thanks Gerald


Gerald Stanley said:
Unbound text boxes do not work well within continuous
forms. A neater solution would be to make the
OpenRecordset sql a query, make the query the RecordSource
of the form and make the text boxes bound controls.

Hope That Helps

Gerald Stanley MCSD
 

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