How Many Records Selected in Datasheet View?

D

dchendrickson

I am using Access2002/XP Pro.

I have a form with a subform displaying records in the
datasheet view. When a record is selected in the subform
and deleted, the code managing the delete process is
somewhat complex.

As it stands, I suspect my code would melt down if a user
were to select more than one record and then delete. So
until I have some "spare time" and can fortify my code, I
would like to check if more than one record has been
selected, instruct the user to only delete one at a time,
then cancel the operation.

Is there a 'canned' method or property that I can put in
the Form_Delete() event that will return the number of
records selected in the datasheet view of the subform?

Thanks in advance.

-dc
 
T

TC

Me.SelHeight gives the number of records currently selected. But it is only
usable in certain contexts. For example, it is not usable from a button
click event, because by the time that the click event fires, the focus has
moved away from the recordselectors (so SelHeight returns 0 then).

HTH,
TC
 
D

dchendrickson

Thanks,

this was just what I was looking for. Hadn't used it and
was not familiar. As is often the case, I am not smart
enough to get the Access help torcher device to cough up
the goods.

-dc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top