G
Guest
I have created a report that opens a query to supply totals on the 'On
Format' event of a report footer.
Dim Conn As ADODB.Connection
Dim rst As ADODB.Recordset
Set Conn = New ADODB.Connection
Conn.Open CurrentProject.Connection
Set rst = New ADODB.Recordset
rst.Open "qryTotalRepairHours", Conn, adOpenDynamic,
adLockOptimistic
rst.Find "fldRepairedPartNumber = '" &
Me!txtRepairedPartNumber & "'"
Me!txtGrandTotal = rst![Grand Total]
Me!txtGrandCount = rst![Grand Count]
Me!txtCountOffldRepairedPartNumber =
rst![CountOffldRepairedPartNumber]
Me!txtTotalUnitRepairCost = rst![SumOffldUnitRepairPrice]
rst.Close
'Release Table and Connection
Set rst = Nothing
Set Conn = Nothing
There are actually 2 queries that feed one (qryTotalRepairHours). Each of
the queries use a date field. If I criteria the date with 'is notnull' (in
both feeding queries), it works fine and I get all the dates entered. If I
try to narrow the date by using 'between'(in both feeding queries) it gives
me an error and highlites the open statement.
rst.Open "qryTotalRepairHours", Conn, adOpenDynamic, adLockOptimistic
Any thoughts.
Format' event of a report footer.
Dim Conn As ADODB.Connection
Dim rst As ADODB.Recordset
Set Conn = New ADODB.Connection
Conn.Open CurrentProject.Connection
Set rst = New ADODB.Recordset
rst.Open "qryTotalRepairHours", Conn, adOpenDynamic,
adLockOptimistic
rst.Find "fldRepairedPartNumber = '" &
Me!txtRepairedPartNumber & "'"
Me!txtGrandTotal = rst![Grand Total]
Me!txtGrandCount = rst![Grand Count]
Me!txtCountOffldRepairedPartNumber =
rst![CountOffldRepairedPartNumber]
Me!txtTotalUnitRepairCost = rst![SumOffldUnitRepairPrice]
rst.Close
'Release Table and Connection
Set rst = Nothing
Set Conn = Nothing
There are actually 2 queries that feed one (qryTotalRepairHours). Each of
the queries use a date field. If I criteria the date with 'is notnull' (in
both feeding queries), it works fine and I get all the dates entered. If I
try to narrow the date by using 'between'(in both feeding queries) it gives
me an error and highlites the open statement.
rst.Open "qryTotalRepairHours", Conn, adOpenDynamic, adLockOptimistic
Any thoughts.