Setting focus to previous control that had focus

fzamora

Software Engineer
Local time
Today, 11:56
Joined
May 28, 2004
Messages
6
Setting focus to previuos control that had focus

I am trying to give focus back to a control that had the focus after updating data on other controls in a sub. Since I have to Setfocus to the textbox that I need to update I would like to give the focus back to the control that the user originally moved to. This is on the AfterUpdate event. I have tried using the Me.ActiveControl and Screen.ActiveControl properties but they give me errors can some please help me out with this. I would really appreciate it. Thanks in advance.
 
Since I have to Setfocus to the textbox that I need to update
- no you don't! If you are having this problem it is because you are using the .text property of a control when you should be using .value or omitting the property entirely since .value is the default. The .text property is different in Access than in VB. Read the help entries to understand why you should not normally be using the .text property.
 
using value instead of text property

Thanks a lot Pat. Using value works perfect. Sorry but I am new to programming with VBA. It is the first project I have ever gotten to do with VBA and Access. I mainly work with C++/MFC and C#.
 
- no you don't! If you are having this problem it is because you are using the .text property of a control when you should be using .value or omitting the property entirely since .value is the default. The .text property is different in Access than in VB. Read the help entries to understand why you should not normally be using the .text property.


Roger that, I was confussed by this issue also.
I used to program Visual Basic not Visual Basic Applications and saw some small differances.

Thanks
 

Users who are viewing this thread

Back
Top Bottom