Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Row Selection on subforms

Status
Not open for further replies.

BJZeak

Programmer
May 3, 2008
230
CA
This seems to be a basic Windows functionality but I am either having a grey moment and or perhaps Access doesn't provide this feature generically?

Window's I presume, inherently can: (part of the Kernel?)

1) select all rows with CTRL A

2) select multiple consecutive rows using the shift key in combination with Arrow and or mouse clicks

3) select/deselect individual rows with the CTRL key and a mouse click combination

I have a standard form with a linked/bound subform ... this subform allows me to do selections using the first and second methods but not the 3rd. But its kind of hard to use this selection process if I can't determine what was selected.

Issue A) does anyone know if there is an Access object reference/property that indicates a row as selected? Or would one possibly have to get down into the WINAPI for this information? The subform is showing the selections so somewhere there has to be a flag.

Issue B) if "A" is possible is there also a form property that would allow the CTRL selection option or would one have to build an event procedure to toggle the selection flag?

Some references I have found to this question indicate people are adding extra tables with boolean fields to individually select a row using check boxes ... is this the only way forward?
 
You haven't stated whether or not you have considered using a multi-select list box rather than a subform. There are SelTop, SelHeight, SelWidth, and SelLeft properties that identify what is selected. I don't think there is a native/easy method for multi, noncontiguous selection in Access (other then a list box).

Duane
Hook'D on Access
MS Access MVP
 
I just went through all the object suffixes for a DAO object plus dove into the ME recordset properties and nothing reached out to me ... now looking through the DAO details on MSDN but again nothing is coming to the surface ... Somewhere there has to be a flag ... perhaps its hidden and or private because for the most part the normal selection process appears to be having a cause and effect on the screen ... I just realized also that this subform/parentform has the key preview properties turned on so this maybe affecting the CTRL selection process ... I will temporarily turn this off and see if the CTRL starts working.

The form currently has one text box which is a concatenated wild search ... this is linked to the QUERY on the subform and all the fields are bound ... the subform lists key fields from the queried records and the footer displays the row specific details ... to do this in a list box I expect would require considerable rework to this form.

I have a double click algorith that I have used in another application to flag rows for printing which I may have to use for now ... I was just hoping someone would have a simpler solution.
 
There is no native solution to do a non contiguous selection and I have never seen an API solution.

Does the selection process have to be done on a form that allows data entry? The easiest solution, as dhookum points out, would be a multi select listbox. Than you can do a noncontigous row selection. The other choice is a listview which also provides native checboxes and non contigous selection.

Like you said I either put a dummy boolean field directly in the item's table, "blnSelected" or I create a seperate table called "tblSelected" In that I store the primary key of the records that I "select".

The process would be something like
1)open the form
2)select you records using a bound checkbox
3)do something with those records
4)once done do an update query to clear out the selection

I will often use two multiselect to push selections back and forth between them
"lstNotSelected" to the "lstSelected"

lstNotSelected has a row source of something like
Select * from table where id not in(select ID from tblSelected)

lstSelected has the row source something like
Select * from table where id in(select ID from tblSelected)

Now as you push between lists use an append query or delete query to add/remove the ID from tblSelected
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top