populate form with data

  • Thread starter Thread starter Richard
  • Start date Start date
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
 
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
 
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
 
Back
Top