Copy text from one text box to other (Microsoft Access VBA) -
i working ms access form , vba edit address information. need able select part of address capture selected part , assign variable.
for example: text box on form has in it: "200 main st bldg 27". select 'st bldg 27' using mouse , click button copy selected text.
the sub function have written
private sub mouseupevent(button integer, shift integer, x single, y single) if len(form_frm_messages.sms_text.seltext) > 0 dim clipboard msforms.dataobject dim strcontents string docmd.openform "frm_sales_entry", acnormal set clipboard = new msforms.dataobject clipboard.settext form_frm_messages.sms_text.seltext clipboard.putinclipboard clipboard.getfromclipboard strcontents = clipboard.gettext else 'do nothing end if end sub
but when calling method mouseupevent 1, 1, 0, 0 throwing error saying 'you can't reference property or method control unless control has focus'. if i'm setting focus selecting whole text in text box.
any vba code solution great.
Comments
Post a Comment