![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I'd like to allow a user to select several non-contiguous rows in a datasheet form and then click a button to delete these records from a table, or perform some other action on them (via a vba routine). I tried adding an unbound checkbox to the form, but when it is checked, they all get checked. Does someone know a good way to do this? thanks -John |
#3
| |||
| |||
|
|
I'd like to allow a user to select several non-contiguous rows in a datasheet form and then click a button to delete these records from a table, or perform some other action on them (via a vba routine). I tried adding an unbound checkbox to the form, but when it is checked, they all get checked. Does someone know a good way to do this? |
#4
| |||
| |||
|
|
the checkbox idea will work, but only if the checkbox is bound to a field in the form's underlying recordset. you can do this by setting up a temp table (i usually put the table in a temp database located on the user's PC, and link it to the frontend db; that takes care of the bloating issue associated with adding/deleting records over and over, as well as the multi-user conflict issue). the table needs only two fields: a field to hold the primary key value from the data table, and a Yes/No field. in the form's RecordSource, link the temp table to the data table on the primary key fields in each, using a LEFT JOIN from the data table to the temp table. bind the Yes/No field to a checkbox in the form. write a query to delete all records from the data table WHERE the primary key = the primary key field of the temp table. write another query to delete all records from the temp table. add a button to the form to run the queries, for example DoCmd.SetWarnings False DoCmd.OpenQuery "qryDeleteDataRecords" DoCmd.OpenQuery "qryDeleteTempRecords" DoCmd.SetWarnings True Me.Requery so the user can checkmark the records to be deleted, click the button, and the code will delete those records, empty the temp table, and then requery the form so the deleted records "disappear". hth "freddy007" <jojo (AT) ebold (DOT) com> wrote in message news:535ceb58-98bb-4c34-bf8d-9ea71b5d67ea (AT) y6g2000prf (DOT) googlegroups.com... I'd like to allow a user to select several non-contiguous rows in a datasheet form and then click a button to delete these records from a table, or perform some other action on them (via a vba routine). I tried adding an unbound checkbox to the form, but when it is checked, they all get checked. Does someone know a good way to do this? thanks -John |
![]() |
| Thread Tools | |
| Display Modes | |
| |