This code fails at the very last line and it's driving me nuts! Can anyone
see why? It's called from a command button on a form and the query returns
one record:
Call libRecalcHours(Me, "txtNotApproved", "Select * from
qryHoursNotApproved")
Public Sub libRecalcHours(frm As Form, strCtlName As String, strSQL As
String)
Dim db As DAO.Database, rs As DAO.Recordset, strSum As String
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
With rs
.MoveLast
strSum = !SumHours
End With
rs.Close
Set rs = Nothing
db.Close
Set db = Nothing
frm.strCtlName.Value = strSum ** Here is where it fails
("Application-defined or object-defined error"). "txtNotApproved" is
unbound.
End Sub
Many thanks.
Keith.