[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 579
  • Last Modified:

Delete Record Using Checkbox

Hello:

I have a form in DataSheet View. I want to click on the checkbox to delete a record. When I first open the form and click on the checkbox, a message pops up saying "You are about to Delete 0 Record(s)". When I click off the checbox then the pop up says "You are about to Delete 1 Record(s)". When I click ok it shows #Deleted in the textboxes. I am not sure why I have to click off the checkbox to delete the record.

Dan
Private Sub DeleteRecord_Click()
DoCmd.RunSQL "Delete * From Data WHERE chkBox = True;"
Me.Requery
End Sub

Open in new window

0
RecipeDan
Asked:
RecipeDan
  • 2
1 Solution
 
danishaniCommented:
Is the checkbox located in the same record as the record you want to delete or at the Mainform?

HTH,
Daniel
0
 
hnasrCommented:
Try it in the Form_Afterupdate event
0
 
hnasrCommented:
Correction:

Private Sub chkBox _Click()
    Me.Dirty = False
    DoCmd.RunSQL "Delete * From a WHERE chkBox = True;"
   Me.Requery
End Sub
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now