Can't delete record from form

ellenr

Registered User.
Local time
Today, 11:27
Joined
Apr 15, 2011
Messages
400
Feeling dumb here. My form is based on a mysql table, not a query. It has the usual auto-incremented ID field and a proper timestamp field. Other than that it has 4 varchar(30) fields, one time/date field and 4 int(11) fields. Adding a record is easy. A "Delete Record" button appears on each record. When I click it I get a Type Mismatch error and the fields fill up with Deleted###. How to fix?
 
What's the code behind the delete button?
 
Code behind delete button:

Code:
Private Sub Command99_Click()
On Error GoTo Err_Command99_Click
    RunCommand acCmdDeleteRecord   
Exit_Command99_Click:
    Exit Sub
Err_Command99_Click:
    MsgBox err.Description
    Resume Exit_Command99_Click
End Sub

Before I did it this way, I had a macro delete record, but it didn't work either.
 
I took out some validation code out of the OnExit event of 4 of the fields, and now all is well. I still don't understand why it was complaining, but I am happy. Thank you for looking at it.
 
I haven't used MySQL but I'd expect it to work. Try this shot-in-the-dark:

DoCmd.RunCommand acCmdDeleteRecord

It's also funny that the display shows Deleted###. The record isn't deleted I take it?
 
Oops, I type too slow. That is odd, those events shouldn't have been firing anyway.
 

Users who are viewing this thread

Back
Top Bottom