Since my previous attempt (posted in a previous thread with no response) didn't work, I decided to punt and simplify things a bit. So I wrote a routine that merely opens a recordset of section numbers, loops through them, and prints the section number in the debug window.
The program runs, but it only prints 0s in the immediate window. All section numbers are integers from 1 to approximate 6015. The sectionSQL variable that creates the recordset works--it's extremely basis, plus I tested it as a regular query before putting it into the VBA module.
Can someone please help? Code is below. Thanks.
Private Sub section_no()
Dim anssecid As Integer
Dim rstSections As ADODB.Recordset
Set rstSections = New ADODB.Recordset
Dim sectionSQL As String
sectionSQL = "select pvmt_analysis_section_id as anssecid from section_info"
rstSections.Open sectionSQL, CurrentProject.Connection
Do Until rstSections.EOF
Debug.Print anssecid
Loop
End Sub
The program runs, but it only prints 0s in the immediate window. All section numbers are integers from 1 to approximate 6015. The sectionSQL variable that creates the recordset works--it's extremely basis, plus I tested it as a regular query before putting it into the VBA module.
Can someone please help? Code is below. Thanks.
Private Sub section_no()
Dim anssecid As Integer
Dim rstSections As ADODB.Recordset
Set rstSections = New ADODB.Recordset
Dim sectionSQL As String
sectionSQL = "select pvmt_analysis_section_id as anssecid from section_info"
rstSections.Open sectionSQL, CurrentProject.Connection
Do Until rstSections.EOF
Debug.Print anssecid
Loop
End Sub