rvtct00
Dec 30 2009, 10:20 AM
I have four fields BankBalance, Cash, CVInsurancePolicy, InvestmentBalance. Each of these fields has code in the "On Lost Focus" in their properties section. See Below:
Private Sub BankBalance_LostFocus()
Me.BankBalance = Nz(Me.BankBalance, 0)
End Sub
Private Sub Cash_LostFocus()
Me.Cash = Nz(Me.Cash, 0)
End Sub
Private Sub CVInsurancePolicy_Exit(Cancel As Integer)
Me.CVInsurancePolicy = Nz(Me.CVInsurancePolicy, 0)
DoCmd.GoToControl "Cash"
End Sub
Private Sub InvestmentBalance_LostFocus()
Me.InvestmentBalance = Nz(Me.InvestmentBalance, 0)
End Sub
I have a reset button that runs four delete queries that deletes the data from the tables. See the code for it:
Private Sub CmdBtnResetFrmOICWS_Click()
Dim strfile_name As String
Dim strwork_string As String
DoCmd.SetWarnings False
DoCmd.OpenQuery "DeleteQry1", acViewNormal, acEdit
DoCmd.OpenQuery "DeleteQry2", acViewNormal, acEdit
DoCmd.OpenQuery "DeleteQry3", acViewNormal, acEdit
DoCmd.OpenQuery "DeleteQry4", acViewNormal, acEdit
DoCmd.SetWarnings True
intcount = 0
DoCmd.Close
DoCmd.OpenForm ("frmOICWS")
End Sub
When I click on the reset button I get an error messages that says: "Runtime error '-2147352567 (80020009)': Record in table TblStep1 was deleted by another user. When I click on the debug, it takes me to the On lost focus.
I need help correct this runtime error.
Thanks,
RVTCT00
AvgJoe
Dec 30 2009, 11:10 AM
RVTCT00,
Not sure if this is the problem, but in my Delete queries, there's nothing after acViewNormal (and they all work fine - I'm using A2K3).
HTH,
AvgJoe
rvtct00
Dec 30 2009, 11:47 AM
Not sure if this is the problem, but in my Delete queries, there's nothing after acViewNormal (and they all work fine - I'm using A2K3).
I removed the , acEdit at the end of my delete queries. I saved it and re-ran the reset button. This did not work. It still bombs and when you click on de-bug it goes to the "On lost focus".
Help anyone??
Jack Cowley
Dec 30 2009, 12:03 PM
It is not a good idea to delete records. What if someone deletes the wrong record? I would suggest you add a Yes/No field to your table named Deleted and instead of deleting the record have code check that field. Now you can recall your deleted records at any time and query will show only active records...
My 3 cents worth...
Jack
rvtct00
Dec 30 2009, 12:30 PM
The db only creates a report. The report is saved to the users hard drive in a word (RTF) format. The DB is nothing but a look up db that does some calculations. My boss does not want any data stored in the tables. He wants the user to delete the data out once done.
This is why I am using delete queries. But it does not like the On lost focus.
Thanks,
TT
Jack Cowley
Dec 30 2009, 01:33 PM
How about a command button to delete all the records in the table when the user is finished?
CurrentDb.Execute "DELETE * FROM MyTable", dbFailOnError
Another way to skin this Access cat...
hth,
Jack
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.