Populating a Continuous from with DAO

SGT68

Registered User.
Local time
Today, 17:03
Joined
May 6, 2014
Messages
76
Hello folks

I'm trying to populate a list which is an Access form that is Default View: Continuous forms.


How do you get to bind to a continuous form's fields with VBA and DAO? I guessed that the form object was an array

Here is my code:

Private Sub PopulateForm()
Dim njpn As DAO.Database
Dim rsPplMembSubs As DAO.Recordset
Dim strSQLPplMembSubs As String

Dim counter As Integer



Set njpn = CurrentDb
strSQLPplMembSubs = "its long so i havent included it"

Set rsPplMembSubs = njpn.OpenRecordset(strSQLPplMembSubs, dbOpenSnapshot)

counter = 0
Do While Not rsPplMembSubs.EOF
Me(counter)!MemberNo = rsPplMembSubs.Fields("MemberNo")
Me(counter)!PersonID = rsPplMembSubs.Fields("PersonID")
Me(counter)!Surname = rsPplMembSubs.Fields("Surname")
Me(counter)!FName = rsPplMembSubs.Fields("FName")
Me(counter)!Title = rsPplMembSubs.Fields("Title")
Me(counter)!SubID = rsPplMembSubs.Fields("SubID")
Me(counter)!StartDate = rsPplMembSubs.Fields("Current_sub_start_date")
Me(counter)!CODE = rsPplMembSubs.Fields("MemCode")
Me(counter)!Instalment = rsPplMembSubs.Fields("SubInstalmentPayment")
Me(counter)!TotPaid = rsPplMembSubs.Fields("TotPaidToDate")
Me(counter)!Outstanding = rsPplMembSubs.Fields("OutstandingAmount")

rsPplMembSubs.MoveNext
counter = counter + 1
Loop

rsPplMembSubs.Close
njpn.Close
Set rsPplMembSubs = Nothing
Set njpn = Nothing


End Sub



using Me(counter)!wotever was a guess and it didnt work. The rest of the code works fine cos if i take out the (counter) from everywhere i get the last record displayed in the form as i would expect.

So.. how does the continuous form object work? what do i need to do?

Thanks
 
Why not set the recordsource for the form to a table or query?
 
Why not set the recordsource for the form to a table or query?

Because I want to see if it can be done with code alone.
 

Users who are viewing this thread

Back
Top Bottom