Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Abbie Cohen   on Mar 04 In MS Office Category.

  
Question Answered By: Jackson Williams   on Mar 04

Thanks for taking the time to offer such a detailed response and set of
suggestion. Also accept my apologies for this delayed response to your reply.

My error with the control index  (also pointed out by Pascal), was actually an
editing error on my part when I tried to simplify the post. My actual code  was:
DataEntryForm.Controls("cbT_Code1").SetFocus

You also offered the comment :
".However, there is also the fact that you are doing this from a text box
exit event, and the move  that caused the exit might happen after the exit event
completes."

This proved to be the thing I need to resolve my problem. With a clear head the
next morning, I discovered (through careful observation as I manually stepped
through the code) that your comment was right on the mark. The problem proved
to be with using the <Tab> key when moving through the cells... Even though
SetFocus was been executed, the Exit Event insisted on issuing the <Tab>.

Because of some "Enter Event" code associated with combobox1 (or further
ignorance on my part), I had no success with "Cancel = True" in the textbox1
Exit Event. The code executed the line without error, but the <Tab> still
occurred.

I finally ended up moving the conditional test to the textbox1 Enter Event and
added a Boolean flag that is tested/trapped in the combobox1 Enter Event. This
finally resolved my problem.

Share: