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
Set ctrl = frm.ActiveControl
If ctrl.SelLength = 0 Then
ctrl.SelStart = 0
ctrl.SelLength = Len(ctrl.Text)
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?