Question : dblclick event in a textbox -- seltext not available

Hi,

Access 2003 VBA question.  I need to be able to retrieve the .seltext property of a textbox (txText) after double-clicking on a word (which gets highligted).  The following code:

Private Sub txText_DblClick(Cancel As Integer)

MsgBox txText.SelStart
MsgBox txText.SelText

End Sub

Properly shows the .SelStart integer (in this case insertion point), but .SelText is blank because this property gets loaded AFTER the event is fully executed.  In other words, highlighting of the word happens after all custom code for the event is run.

Is there a way to control the flow of the mini-events within an event?  Or, is there a way to post an event/sub/function immediately after an event is executed?  Any other ideas?

(Target:  Double-clicking on words on a form triggers automatic copying (inserting) of the words to a table.)

Thank you,

Mirek

Answer : dblclick event in a textbox -- seltext not available

How about:
Private Sub txText_DblClick(Cancel As Integer)

Me.TimerInterval = 500            '1/2second

End Sub

Private Sub Form_Timer()

Me.TimerInterval = 0
MsgBox txText.SelStart
MsgBox txText.SelText

End Sub
Random Solutions  
 
programming4us programming4us