DBL
Registered User.
- Local time
- Today, 17:15
- Joined
- Feb 20, 2002
- Messages
- 659
I'm using the current code in a function. It was written in Access 2000 and I wondered if there was anyway to update it so it can run in Access 2010 without having to specify the old reference.
Public Function ApplianceList(WOProp As Integer) As String
Dim strSQL1 As String
Dim Answer As String
Dim i As Integer
Dim rs As New ADODB.Recordset
'"SELECT qryCausesOfDeath.CDCase, qryCausesOfDeath.CDOrder, qryCausesofDeath.CDCause "
strSQL1 = "SELECT qryApplianceList.PropAppProp, qryApplianceList.PropAppDesc " _
& " FROM qryApplianceList " _
& " WHERE qryApplianceList.PropAppProp = " & WOProp _
& " ORDER BY qryApplianceList.PropAppID;"
rs.Open strSQL1, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If rs.RecordCount >= 1 Then
rs.MoveFirst
For i = 1 To rs.RecordCount
Answer = Answer & rs!PropAppDesc & " "
rs.MoveNext
Next i
ApplianceList = Answer
End If
End Function
I use the code to loop through a filtered list of records and to put all the records into a string for reporting purposes.
Thanks
D
Public Function ApplianceList(WOProp As Integer) As String
Dim strSQL1 As String
Dim Answer As String
Dim i As Integer
Dim rs As New ADODB.Recordset
'"SELECT qryCausesOfDeath.CDCase, qryCausesOfDeath.CDOrder, qryCausesofDeath.CDCause "
strSQL1 = "SELECT qryApplianceList.PropAppProp, qryApplianceList.PropAppDesc " _
& " FROM qryApplianceList " _
& " WHERE qryApplianceList.PropAppProp = " & WOProp _
& " ORDER BY qryApplianceList.PropAppID;"
rs.Open strSQL1, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If rs.RecordCount >= 1 Then
rs.MoveFirst
For i = 1 To rs.RecordCount
Answer = Answer & rs!PropAppDesc & " "
rs.MoveNext
Next i
ApplianceList = Answer
End If
End Function
I use the code to loop through a filtered list of records and to put all the records into a string for reporting purposes.
Thanks
D