Count selected records in a continuous form

I'm trying to determine how many records are selected in a continuous subform.

I have a custom shortcut menu for a form which displays detailed information on the currently selected record.  The function that is called by this shortcut menu item is used in several different forms, so it uses the following code to drill down if the active form is a subform.

    dim frm as Form
    Set frm = Screen.ActiveForm
    Do While frm.ActiveControl.ControlType = acSubform
        Set frm = frm.ActiveControl.Form
    Loop

This code works great, unless the user clicks on the record selector rather than clicking in a field on the form.  In that case, there is no ActiveControl, and the Do While line generates the error:

#2474: The expression you entered requires the control to be in the active window.

I've figured out that the Form_MouseUp event occurs whenever the user clicks on a record selector, and by putting a line in the mouseup event that sets the focus to one of the controls in that record, it actually prevents the user from selecting multiple records, which resolves my problem.  

However, this raised the question in my mind about record selectors.  I noticed another post recently that the user wanted to know how many records from a continuous form were being selected in a deletion operation, and the answer related to the BeforeDeleteConfirm event.  I also found a post from several years back where jDettman referenced the Access Developers Handbook, but I have not been able to find any code in the version I have on hand that deals with this topic.

I'd like to be able to use the MouseUp event to determine how many records are selected.  Any ideas?


LVL 52
Dale FyeOwner, Developing Solutions LLCAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

answer_dudeCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dale FyeOwner, Developing Solutions LLCAuthor Commented:
Precisely what I was looking for.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.