Unable to copy text from locked textbox in 2007 form opened with acDialog window mode

I've got a custom copy function (below) which is called via a shortcut menu in a variety of my forms.  This function generally works quite well, but I recently discovered that when I call this code from a form that was opened with the acDialog window mode, it does not work.

Public Function fnTextCopy()

    Dim frm As Form
    Dim ctrl As Control
   
    Set frm = Screen.ActiveForm
    Do While frm.ActiveControl.ControlType = acSubform
        Set frm = frm.ActiveControl.Form
    Loop
    Set ctrl = frm.ActiveControl
   
    If ctrl.SelLength = 0 Then
        ctrl.SelStart = 0
        ctrl.SelLength = Len(ctrl.Text)
    End If
   
    DoCmd.RunCommand acCmdCopy
       
End Function

If I put a breakpoint on the "End Function" line, then I can go to the immediate window and paste the copied value (either with Ctrl-V or the right-click shortcut menu), but as soon as the function exits, the clipboard seems to drop the copied text.  Interestingly, Ctrl-C does not work to copy text from these textboxes either.  When I open the form without the "acDialog" window mode, the code and Ctrl-C both work.  When I set the forms modal property to true, I was able to drop the acDialog window mode from the FormOpen method, and the function and Ctrl-C both work as well, so this is how I will resolve my issue.  

But that still leaves the question, why won't this work when opened with acDialog window mode?  Is this a bug?
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.

Rey Obrero (Capricorn1)Commented:
when a form is opened with acDialog window mode,
that form will have the focus, suceeding codes from where the form was open will be at halt, and will continue only when the form opened in modal mode was closed.
0
Dale FyeOwner, Developing Solutions LLCAuthor Commented:
That is not the issue.

fnTextCopy() is called by a shortcut menu, which is called from within any of the textboxes in the form that was opened with acDialog.

The function runs fine, its just that the clipboard seems to loose the copied text as soon as the function exits.  As I stated, if I drop acDialog and change the forms modal property to True, the form opens modal, and the function works fine.  That is why I'm inclined to thing there is a bug.
0
Rey Obrero (Capricorn1)Commented:
with acDialog, the forms modal and popup property are set to yes
0
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

Dale FyeOwner, Developing Solutions LLCAuthor Commented:
Understood!

But the question is, why is Access preventing me from copying text (Ctrl-C or my function) from a textbox on a form that is opened with acDialog?
0
Rey Obrero (Capricorn1)Commented:
can i see your form?
0
Dale FyeOwner, Developing Solutions LLCAuthor Commented:
am troubleshooting now.

I was going to send a sample database this AM.  I built this new one from scratch (imported my menu code and functions) but when I got done, I could not duplicate the problem.  So, now I'm going back to the original db and taking a look at the form to see if there is something else going on.  Will post back.
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
Rey Obrero (Capricorn1)Commented:
i did made a test and i could copy the contents of the textboxes with ctrl + c

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.