I tried to run the code below, but got an error saying that I was not providing a required parameter, on the line marked in red--it runs fine up to that point. I'm trying to nest looping through one recordset within another (sections with projects on them, an expansion of the simple recordset question y'all helped me with earlier).
Private Sub overlay_no()
Dim rstSections As ADODB.Recordset
Set rstSections = New ADODB.Recordset
Dim rstRehabs As ADODB.Recordset
Set rstRehabs = New ADODB.Recordset
Dim sectionSQL As String, rehabSQL As String
Dim anssecid As Integer, count As Integer
rehabSQL = "select * from rehab_proj_join where pvmt_analysis_section_id=rstSections!anssecid"
sectionSQL = "select pvmt_analysis_section_id as anssecid from section_info order by pvmt_analysis_section_id"
rstSections.Open sectionSQL, CurrentProject.Connection
rstSections.MoveFirst
count = 1
Do Until rstSections.EOF
Debug.Print rstSections!anssecid
rstRehabs.Open rehabSQL, CurrentProject.Connection
rstRehabs.MoveFirst
Do Until rst.Rehabs.EOF
Debug.Print rstRehabs!proj_date
count = count + 1
rstRehabs.MoveNext
Loop
rstSections.MoveNext
Loop
End Sub
Private Sub overlay_no()
Dim rstSections As ADODB.Recordset
Set rstSections = New ADODB.Recordset
Dim rstRehabs As ADODB.Recordset
Set rstRehabs = New ADODB.Recordset
Dim sectionSQL As String, rehabSQL As String
Dim anssecid As Integer, count As Integer
rehabSQL = "select * from rehab_proj_join where pvmt_analysis_section_id=rstSections!anssecid"
sectionSQL = "select pvmt_analysis_section_id as anssecid from section_info order by pvmt_analysis_section_id"
rstSections.Open sectionSQL, CurrentProject.Connection
rstSections.MoveFirst
count = 1
Do Until rstSections.EOF
Debug.Print rstSections!anssecid
rstRehabs.Open rehabSQL, CurrentProject.Connection
rstRehabs.MoveFirst
Do Until rst.Rehabs.EOF
Debug.Print rstRehabs!proj_date
count = count + 1
rstRehabs.MoveNext
Loop
rstSections.MoveNext
Loop
End Sub