C
crosley4
This function worked in Access 2003, but does not in 2007, can anyone
please tell me why not. The ADODB .Recordset declaration and the .
Active Connection parameter don't seem to work for starters.
What I am doing is scroll through a recordset, "CurrentGradStudents
table" and storing the values for display on a report into a variable
"strHold" then formating the value in a field called "cltDest".Public Function LookUpAbsentias()
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
Dim strHold As Variant
Dim ctlDest As Controls
Dim cltDest As Variant
With rst
Set .ActiveConnection = CurrentProject.Connection
.CursorType = adOpenKeyset
.Open "LookUpAbsentias", Options:=adCmdTableDirect
If .RecordCount > 0 Then
.MoveFirst
Do Until .EOF
strHold = strHold & "" & .Fields("Name") & " ("
& .Fields("Term") & ") " & ", "
.MoveNext
Loop
End If
cltDest = "Absentia:" & vbCrLf & strHold & vbCrLf & vbCrLf & _
"* F=Fall Only; S=Spring Only; Y=Fall and Spring "
'MsgBox cltDest
Reports![FieldList2Report]![Absentias].Caption = cltDest
.Close
End With
Set rst = Nothing
End Function
please tell me why not. The ADODB .Recordset declaration and the .
Active Connection parameter don't seem to work for starters.
What I am doing is scroll through a recordset, "CurrentGradStudents
table" and storing the values for display on a report into a variable
"strHold" then formating the value in a field called "cltDest".Public Function LookUpAbsentias()
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
Dim strHold As Variant
Dim ctlDest As Controls
Dim cltDest As Variant
With rst
Set .ActiveConnection = CurrentProject.Connection
.CursorType = adOpenKeyset
.Open "LookUpAbsentias", Options:=adCmdTableDirect
If .RecordCount > 0 Then
.MoveFirst
Do Until .EOF
strHold = strHold & "" & .Fields("Name") & " ("
& .Fields("Term") & ") " & ", "
.MoveNext
Loop
End If
cltDest = "Absentia:" & vbCrLf & strHold & vbCrLf & vbCrLf & _
"* F=Fall Only; S=Spring Only; Y=Fall and Spring "
'MsgBox cltDest
Reports![FieldList2Report]![Absentias].Caption = cltDest
.Close
End With
Set rst = Nothing
End Function