Okay, "not working" means what, exactly? Did you get an error? Can you post a sample copy of your db? It might be faster to figure out what you're trying to do, if we could see it.
Okay, "not working" means what, exactly? Did you get an error? Can you post a sample copy of your db? It might be faster to figure out what you're trying to do, if we could see it.
Okay, if a subform is involved here, then it may be a matter of using the correct syntax. Can you post a sample copy of your db, so we can tell you what syntax you could use?
Okay, if a subform is involved here, then it may be a matter of using the correct syntax. Can you post a sample copy of your db, so we can tell you what syntax you could use?
This is the most weird ever :banghead:
If i cause an error by not moving the focus to that txtBox and then debug and move the focus there and let the code continue to run it will select what I'm looking for.
If I let the code run as it should (move the focus to that txtBox) and then try to select what I want it will select the entire text
If i cause an error by not moving the focus to that txtBox and then debug and move the focus there and let the code continue to run it will select what I'm looking for.
If I let the code run as it should (move the focus to that txtBox) and then try to select what I want it will select the entire text
What exactly are you trying to select if not the entire text?
Is there more code than what you have shown?
provided you have the proper reference and can set the focus to the textbox
try something like
Code:
me.yoursubform.form.textboxname.setfocus
me.yoursubform.form.textboxname.SelStart = 0 ' or whatever place you want to start
me.yoursubform.form.textboxname.SelLength = len(me.yoursubform.form.textboxname) ' or whatever length you want
What exactly are you trying to select if not the entire text?
Is there more code than what you have shown?
provided you have the proper reference and can set the focus to the textbox
try something like
Code:
me.yoursubform.form.textboxname.setfocus
me.yoursubform.form.textboxname.SelStart = 0 ' or whatever place you want to start
me.yoursubform.form.textboxname.SelLength = len(me.yoursubform.form.textboxname) ' or whatever length you want
this code will case an error on the marked line.
If I debug and let the code continue from next line it will select what I need.
If I remove the error causing line (Or any other error causing line) it will select the entire text
If I put a MsgBox at the end I can see it select OK, but once I click the msgbox it will select the entire text
even an Exit Sub just after this won't help