This is my first time using ADO instead of DAO. All of the statements compile and work (I used breakpoints/watch to ensure that they are working) EXCEPT moving data from my recordset to a textbox on a report.
Can someone tell me the correct syntax for moving data from a recordset to a textbox on a report?
Dim rst As ADODB.Recordset
Dim rpt As Report
Dim fldDEA_No As ADODB.Field
Dim strDEA_No As String
Dim strCustomerName As String
Set rst = New ADODB.Recordset
Set rst.ActiveConnection = CurrentProject.Connection
Set rpt = Reports(rptHistoricalDCAllocations)
rst.Open "tblrptDCUncommitedSplitsandHistory", _
CurrentProject.Connection, CursorType = adOpenForwardOnly
rst.MoveFirst
'Me.Controls(rptDEA_No).ControlSource = rst![DEA_No] 'this syntax doesn't work at all
Set fldDEA_No = rst![DEA_No] 'this works just fine
rpt.rptDEA_No = fldDEA_No 'this syntax doesn't work
Do While Not rst.EOF
If rst.EOF Then
Exit Do
Else
rst.MoveNext
End If
Loop
rst.Close
Can someone tell me the correct syntax for moving data from a recordset to a textbox on a report?
Dim rst As ADODB.Recordset
Dim rpt As Report
Dim fldDEA_No As ADODB.Field
Dim strDEA_No As String
Dim strCustomerName As String
Set rst = New ADODB.Recordset
Set rst.ActiveConnection = CurrentProject.Connection
Set rpt = Reports(rptHistoricalDCAllocations)
rst.Open "tblrptDCUncommitedSplitsandHistory", _
CurrentProject.Connection, CursorType = adOpenForwardOnly
rst.MoveFirst
'Me.Controls(rptDEA_No).ControlSource = rst![DEA_No] 'this syntax doesn't work at all
Set fldDEA_No = rst![DEA_No] 'this works just fine
rpt.rptDEA_No = fldDEA_No 'this syntax doesn't work
Do While Not rst.EOF
If rst.EOF Then
Exit Do
Else
rst.MoveNext
End If
Loop
rst.Close