Due to the high speed, I'm getting wherever, I replaced the domain function I have decided to replace also the Dsum functions to grab the opening balance on the accounting package ledgers. Below is a query I'm trying to open to grab the opening balance but I'm getting an error object not found in the collection, where do I go wrong?
Code:
Private Sub Report_Load()
Dim db As DAO.Database
Dim strSql As String
Dim rs As Recordset
Dim qdf As DAO.QueryDef
Dim prm As DAO.Parameter
Set db = CurrentDb
strSql = "SELECT Sum(Balance) As Totals FROM [QryCustomerLedgerOp] WHERE [CustomerID] =" & [Forms]![frmCityLedger]![CboCustomerID] & " AND [ShipDate]<#" & Format(([Forms]![frmCityLedger]![txtDateA]), "yyyy\/mm\/dd") & "#"
Set qdf = db.QueryDefs(strSql)
For Each prm In qdf.Parameters
prm = Eval(prm.Name)
Next prm
Set rs = qdf.OpenRecordset(dbOpenSnapshot, dbSeeChanges)
rs.MoveFirst
Do While Not rs.EOF
Me.txtOpSpecials = rs!Totals.value
Loop
rs.Close
Set rs = Nothing
Set db = Nothing
Set qdf = Nothing
Set prm = Nothing
End Sub