O
Opal
I need a second pair of eyes to look at the following.
I am trying to clear the data input into a bound subform
using VBA. I have the following module, but get the above
error:
Dim dbobject As DAO.Database
Dim ClearUnsRS As DAO.Recordset
Dim strquery As String
Dim HoldUnsafeTally As Integer
HoldUnsafeTally = Forms!frmDriveAudit.UnsafeTally.Value
Set dbobject = CurrentDb
strquery = "SELECT * FROM Unsafe Where UnsafeTally = " &
HoldUnsafeTally
Set ClearUnsRS = dbobject.OpenRecordset(strquery)
With ClearUnsRS
.MoveFirst
Do While Not .EOF
.Edit
.Fields("UnsafeTally").Value = Null
.Update
.MoveNext
Loop
End With
ClearUnsRS.Close
Now the main form is called frmDriveAudit and the subform
is called subfrmUnsafe. If I change the name of the form in the
code to the subform, I get an error telling me Access cannot find
the form. I'm not sure how to proceed and I hope that another
pair of eyes can see what I'm missing. Thanks.
I am trying to clear the data input into a bound subform
using VBA. I have the following module, but get the above
error:
Dim dbobject As DAO.Database
Dim ClearUnsRS As DAO.Recordset
Dim strquery As String
Dim HoldUnsafeTally As Integer
HoldUnsafeTally = Forms!frmDriveAudit.UnsafeTally.Value
Set dbobject = CurrentDb
strquery = "SELECT * FROM Unsafe Where UnsafeTally = " &
HoldUnsafeTally
Set ClearUnsRS = dbobject.OpenRecordset(strquery)
With ClearUnsRS
.MoveFirst
Do While Not .EOF
.Edit
.Fields("UnsafeTally").Value = Null
.Update
.MoveNext
Loop
End With
ClearUnsRS.Close
Now the main form is called frmDriveAudit and the subform
is called subfrmUnsafe. If I change the name of the form in the
code to the subform, I get an error telling me Access cannot find
the form. I'm not sure how to proceed and I hope that another
pair of eyes can see what I'm missing. Thanks.