Can't delete record from form (1 Viewer)

ellenr

Registered User.
Local time
Today, 10:33
Joined
Apr 15, 2011
Messages
397
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?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 07:33
Joined
Aug 30, 2003
Messages
36,124
What's the code behind the delete button?
 

ellenr

Registered User.
Local time
Today, 10:33
Joined
Apr 15, 2011
Messages
397
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.
 

ellenr

Registered User.
Local time
Today, 10:33
Joined
Apr 15, 2011
Messages
397
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.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 07:33
Joined
Aug 30, 2003
Messages
36,124
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?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 07:33
Joined
Aug 30, 2003
Messages
36,124
Oops, I type too slow. That is odd, those events shouldn't have been firing anyway.
 

Users who are viewing this thread

Top Bottom