Independant selection of datasheet rows

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Apologies in advance if I'm repeating a question from previous postings, but
I've not found exactly what I need...

Consider this simplified situation: Entering a department name into a field
on a main form will show all the member employees in a datasheet sub-form.
Now, I want to allow the user select some arbitrary sub-set of employees
(rows) to be acted upon by various buttons on the main form (e.g. assign to
project, upgrade pay level, etc.). Basically, I want an independant checkbox
associated with each row to be probed later for action vs. its associated row
item.

I can't alter the underlying tables to create a spurious "SELECTED" field
just to support this behavior as other posts have suggested (and that's a
fugly solution, anyway #8>).

I HAVE SEEN A "CORRECT" SOLUTION (unfortunately, in a ".mde" #8>(.

Since I can't probe the solution I have little to go on, but it does seem
that the selection checkboxes next to each row are not actually part of the
datasheet sub-form but are possibly on a middle-level form. I don't know if
that is helpful to potential responders but I offer it in hope.

Also, since I am a nubi, sample (psuedo)code to actually process the
selected rows will be greatly appreciated (e.g. how to get associated key
fields for each checkbox).

MTIA!
 
i usually handle such situations by creating a separate table which is
linked to the data table in a one-to-one relationship on the primary key.
the new table has only the primary key field, and a Yes/No field; and the
table is always empty except when the form is being worked with.

assuming that your subform is based on a tblEmployees:

create a query linking tblEmployees to tblYesNo. include both fields from
tblYesNo, and whatever fields you need from tblEmployees including it's
primary key field. base the subform on this query.

doing the above gives you a bound checkbox in the subform, which is what you
need in order to act on selected subform records. base your updates (upgrade
pay level, etc) on tblYesNo, which contains the primary key values of the
employees you selected in the subform.

that's pretty much it. just remember to run a Delete query to remove the
records from tblYesNo, after you have run your update(s). usually i also run
the Delete query when the form closes, as well - just to be sure it's empty
and ready for the next use.

hth
 
Back
Top