Referencing Multiple Selected Rows in a DataSheet

  • Thread starter Thread starter Eric Dreksler
  • Start date Start date
E

Eric Dreksler

Hello all,

I have a bound form displaying as a DataSheet and I want to allow the user
to select multiple rows/records (and then right click, select from the
custom shortcut....). All this is fine, however, when my code responds to
the shortcut menu event, I can only pull info on the current record (the one
the cursor was over when they right-clicked). I'd like to be able to get
the (or a reference to) the entire selection of rows/records (or it's
somewhat pointless).

Basically, think of opening a table, selecting a couple of rows,
right-clicking and deleting/copying or such.

Thanks In Advance,
Eric Dreksler
 
Can't you just use recordsetclone to navigate around the records? Find and
save the # of the first & last selected record, then:

(untested)

with me.recordsetclone
.absoluteposition = nFirst - 1
while .absoluteposition <= nLast - 1
debug.print .absoluteposition, .fields(0)
.movenext
wend
end with

HTH,
TC
 
The problem is I don't know how to get the indexes of the selected records,
since I can only seem to get one value (the current record - being the one I
was over when I right-clicked), not all the values/indexes of the ones I
selected.

Eric Dreksler
 
The form's SelTop and SelHeight properties give the relative position #s of
the records selected in continuous forms view. The same should occur in
datasheet view. The only problem is, you have to be careful when & how you
trap those values. If you check them from a command button's Click event,
it's no good, because the button takes the focus away from the selected
records before it fires that event. But I imagine you could get them in code
that you ran from a toolbar button.

HTH,
TC
 
Works like a charm, thanks,

Eric Dreksler

TC said:
The form's SelTop and SelHeight properties give the relative position #s of
the records selected in continuous forms view. The same should occur in
datasheet view. The only problem is, you have to be careful when & how you
trap those values. If you check them from a command button's Click event,
it's no good, because the button takes the focus away from the selected
records before it fires that event. But I imagine you could get them in code
that you ran from a toolbar button.

HTH,
TC


one
 
Back
Top