If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
SetFocus
Hello,
I have a form with a combo box and two text boxes. Depending on the selection the user makes I want the cursor to move to one of the text box. Action (combo box) Current_CHL (text box) New_CHL (text box) Add - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Change - - - - - - - - - - - - - - - - - - - - - - - - - Drop - - - - - - - - - - - - - - I have this code attached to the Action Combo: Private Sub Action_AfterUpdate() If Me.Action = "Add" Then Me.New_CHL.SetFocus ElseIf Me.Action = "Change" Then Me.Current_CHL.SetFocus Me.New_CHL.SetFocus ElseIf Me.Action = "Drop" Then Me.Current_CHL.SetFocus End If End Sub The "Add" and "Drop" works, but for some reason, I can't figure out why the "Change" not working. It got to the New_CHL not the Current_CHL. I have the tab stops for both New_CHL and Current_CHL set to no. Can someone help me out, thanks. |
#2
|
|||
|
|||
SetFocus
"Trini Gal" wrote in message
... Hello, I have a form with a combo box and two text boxes. Depending on the selection the user makes I want the cursor to move to one of the text box. Action (combo box) Current_CHL (text box) New_CHL (text box) Add - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Change - - - - - - - - - - - - - - - - - - - - - - - - - Drop - - - - - - - - - - - - - - I have this code attached to the Action Combo: Private Sub Action_AfterUpdate() If Me.Action = "Add" Then Me.New_CHL.SetFocus ElseIf Me.Action = "Change" Then Me.Current_CHL.SetFocus Me.New_CHL.SetFocus ElseIf Me.Action = "Drop" Then Me.Current_CHL.SetFocus End If End Sub The "Add" and "Drop" works, but for some reason, I can't figure out why the "Change" not working. It got to the New_CHL not the Current_CHL. I have the tab stops for both New_CHL and Current_CHL set to no. Can someone help me out, thanks. What is the purpose of setting the focus first to Current_CHL, and then immediately to New_CHL? Are you running some code in the GotFocus of Current_CHL? If so, it would make more sense just to call the control's GotFocus event procedure directly, rather than actually sending the focus the ElseIf Me.Action = "Change" Then Call Current_CHL_GotFocus Me.New_CHL.SetFocus However, I'm not sure why the focus wouldn't be reaching Current_CHL with your current code. Are you sure it isn't getting there, even momentarily? -- Dirk Goldgar, MS Access MVP www.datagnostics.com (please reply to the newsgroup) |
#3
|
|||
|
|||
SetFocus
I'm not running any other code. Also, I'm sure, its not going to Current_CHL
at all, it just goes to New_CHL. The dept. that I'm building the database for wants to limit the users access to fields. So depending on the selection, they want the user to go to only certain fields. If there is a change, they want to know what the Current_CHL is and then what it will be after the approval process is done. Is there any other way of doing this? "Dirk Goldgar" wrote: "Trini Gal" wrote in message ... Hello, I have a form with a combo box and two text boxes. Depending on the selection the user makes I want the cursor to move to one of the text box. Action (combo box) Current_CHL (text box) New_CHL (text box) Add - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Change - - - - - - - - - - - - - - - - - - - - - - - - - Drop - - - - - - - - - - - - - - I have this code attached to the Action Combo: Private Sub Action_AfterUpdate() If Me.Action = "Add" Then Me.New_CHL.SetFocus ElseIf Me.Action = "Change" Then Me.Current_CHL.SetFocus Me.New_CHL.SetFocus ElseIf Me.Action = "Drop" Then Me.Current_CHL.SetFocus End If End Sub The "Add" and "Drop" works, but for some reason, I can't figure out why the "Change" not working. It got to the New_CHL not the Current_CHL. I have the tab stops for both New_CHL and Current_CHL set to no. Can someone help me out, thanks. What is the purpose of setting the focus first to Current_CHL, and then immediately to New_CHL? Are you running some code in the GotFocus of Current_CHL? If so, it would make more sense just to call the control's GotFocus event procedure directly, rather than actually sending the focus the ElseIf Me.Action = "Change" Then Call Current_CHL_GotFocus Me.New_CHL.SetFocus However, I'm not sure why the focus wouldn't be reaching Current_CHL with your current code. Are you sure it isn't getting there, even momentarily? -- Dirk Goldgar, MS Access MVP www.datagnostics.com (please reply to the newsgroup) |
#4
|
|||
|
|||
SetFocus
"Trini Gal" wrote in message
... I'm not running any other code. Also, I'm sure, its not going to Current_CHL at all, it just goes to New_CHL. The dept. that I'm building the database for wants to limit the users access to fields. So depending on the selection, they want the user to go to only certain fields. If there is a change, they want to know what the Current_CHL is and then what it will be after the approval process is done. Is there any other way of doing this? I'm sorry, I don't understand you. If no code is running, how would you ever know whether the focus went first to Current_CHL and then immediately to New_CHL, or whether it skipped it? By the time you could possibly see it, the focus would be on New_CHL. What do you expect to happen when the focus passes oh-so-briefly through Current_CHL? Setting the focus won't control where the user can go, only where they are now. Even if a control is not in the tab order, a user can still click on it to move the focus there, so long as the control is enabled and visible. Maybe you should be controlling the visibility of the controls, rather than setting the focus. But as I said, I don't understand what you are trying to achieve, because your use of SetFocus doesn't seem to make sense in the context of what you said above. -- Dirk Goldgar, MS Access MVP www.datagnostics.com (please reply to the newsgroup) |
Thread Tools | |
Display Modes | |
|
|