newnoviceuser
Programmer
I am so confused if fixed the problem but this keeps happening. this is the code I have and it worked fine
but then i added at the end of rst!checks I added +rst!vouchers when I did I got an error on the rst.findfirst
it said something along the lines of unable to do the operation with this object. ai cant remember exactly
anyway I changed the "sheet" to "select * from sheet"
and it worked fine no error then i changed it back to "sheet" so i could write down the error to ask and it didn't crash it still worked fine. why? i think i am going crazy. now i cant even make it give me the error. but i want to understand
Sub cashclose()
Dim db As Database
Dim rst As Recordset
Dim strcriteria As String
strcriteria = "sheedate = date()"
Set db = CurrentDb
Set rst = db.OpenRecordset("sheet"
rst.FindFirst strcriteria
If rst.NoMatch Then
MsgBox "error"
End If
rst.Edit
rst!total = rst!C100 + (rst!C50 * 0.5) + (rst!C25 * 0.25) + (rst!C10 * 0.1) + (rst!C5 * 0.05) + (rst!C1 * 0.01) + (rst!D100 * 100)
rst!total = rst!total + (rst!D50 * 50) + (rst!D20 * 20) + (rst!D10 * 10) + (rst!D5 * 5) + rst!D1 + rst!CURRENCY + rst!COINS + rst!CHECKS
rst.Update
rst.Close
End Sub
but then i added at the end of rst!checks I added +rst!vouchers when I did I got an error on the rst.findfirst
it said something along the lines of unable to do the operation with this object. ai cant remember exactly
anyway I changed the "sheet" to "select * from sheet"
and it worked fine no error then i changed it back to "sheet" so i could write down the error to ask and it didn't crash it still worked fine. why? i think i am going crazy. now i cant even make it give me the error. but i want to understand
Sub cashclose()
Dim db As Database
Dim rst As Recordset
Dim strcriteria As String
strcriteria = "sheedate = date()"
Set db = CurrentDb
Set rst = db.OpenRecordset("sheet"
rst.FindFirst strcriteria
If rst.NoMatch Then
MsgBox "error"
End If
rst.Edit
rst!total = rst!C100 + (rst!C50 * 0.5) + (rst!C25 * 0.25) + (rst!C10 * 0.1) + (rst!C5 * 0.05) + (rst!C1 * 0.01) + (rst!D100 * 100)
rst!total = rst!total + (rst!D50 * 50) + (rst!D20 * 20) + (rst!D10 * 10) + (rst!D5 * 5) + rst!D1 + rst!CURRENCY + rst!COINS + rst!CHECKS
rst.Update
rst.Close
End Sub