Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default SetFocus problem

I have a userform with 3 textboxes (tbOldPassword, tbNewPassword1,
tbNewPassword2). when the userform is initialized NewPassword1 and
NewPassword2 have the enabled property set to false. In tbOldPassword the
afterupdate subroutine checks the value of what has been entered and then,
if appropriate, sets the enable property of tbNewPassword1 and
tbNewPassword2 to true. The problem is that focus should then (based on the
tabindex property) move to tbNewPassword1; it does not. Focus returns to
tbOldPassword and if I hit enter again, it will then move to tbNewPassword1.
I have tried to force focus to move to tbNewPassword1 by placing
"tbNewPassword1.setfocus" in the afterupdate subroutine following the
"tbNewPassword1.enabled = true" statement but that does not help. Any help
or ideas will be greatly appreciated.

If it helps here is the actual code:

Private Sub tbOldPassword_AfterUpdate()
If Sheets("veryhidden").Range("AdminPswd") = tbOldPassword Then
tbNewPassword1.Enabled = True
Label2.ForeColor = &H80000012
tbNewPassword2.Enabled = True
Label3.ForeColor = &H80000012
tbNewPassword1.SetFocus
Else
tbOldPassword = ""
End If
End Sub

Thanks,
Ralph Fraley


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default SetFocus problem

RF,

after setting the focus try:
Me.Repaint

HTH
Henry

"RFraley" wrote in message
...
I have a userform with 3 textboxes (tbOldPassword, tbNewPassword1,
tbNewPassword2). when the userform is initialized NewPassword1 and
NewPassword2 have the enabled property set to false. In tbOldPassword the
afterupdate subroutine checks the value of what has been entered and then,
if appropriate, sets the enable property of tbNewPassword1 and
tbNewPassword2 to true. The problem is that focus should then (based on

the
tabindex property) move to tbNewPassword1; it does not. Focus returns to
tbOldPassword and if I hit enter again, it will then move to

tbNewPassword1.
I have tried to force focus to move to tbNewPassword1 by placing
"tbNewPassword1.setfocus" in the afterupdate subroutine following the
"tbNewPassword1.enabled = true" statement but that does not help. Any help
or ideas will be greatly appreciated.

If it helps here is the actual code:

Private Sub tbOldPassword_AfterUpdate()
If Sheets("veryhidden").Range("AdminPswd") = tbOldPassword Then
tbNewPassword1.Enabled = True
Label2.ForeColor = &H80000012
tbNewPassword2.Enabled = True
Label3.ForeColor = &H80000012
tbNewPassword1.SetFocus
Else
tbOldPassword = ""
End If
End Sub

Thanks,
Ralph Fraley




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default SetFocus problem

Thanks for the response Henry, but this did not change the end result.

Ralph

"Henry" wrote in message
...
RF,

after setting the focus try:
Me.Repaint

HTH
Henry

"RFraley" wrote in message
...
I have a userform with 3 textboxes (tbOldPassword, tbNewPassword1,
tbNewPassword2). when the userform is initialized NewPassword1 and
NewPassword2 have the enabled property set to false. In tbOldPassword

the
afterupdate subroutine checks the value of what has been entered and

then,
if appropriate, sets the enable property of tbNewPassword1 and
tbNewPassword2 to true. The problem is that focus should then (based on

the
tabindex property) move to tbNewPassword1; it does not. Focus returns to
tbOldPassword and if I hit enter again, it will then move to

tbNewPassword1.
I have tried to force focus to move to tbNewPassword1 by placing
"tbNewPassword1.setfocus" in the afterupdate subroutine following the
"tbNewPassword1.enabled = true" statement but that does not help. Any

help
or ideas will be greatly appreciated.

If it helps here is the actual code:

Private Sub tbOldPassword_AfterUpdate()
If Sheets("veryhidden").Range("AdminPswd") = tbOldPassword Then
tbNewPassword1.Enabled = True
Label2.ForeColor = &H80000012
tbNewPassword2.Enabled = True
Label3.ForeColor = &H80000012
tbNewPassword1.SetFocus
Else
tbOldPassword = ""
End If
End Sub

Thanks,
Ralph Fraley






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Colon at the end of excel file name(ex: problem.xls:1, problem.xls financeguy New Users to Excel 2 January 15th 10 01:15 AM
Started out as an Access problem. Now an Excel problem RobertM Excel Discussion (Misc queries) 2 April 26th 06 07:30 PM
SetFocus on a different sheet in VBA AaronC Excel Discussion (Misc queries) 1 June 9th 05 11:18 PM
SetFocus method in VBA Robin S. Excel Programming 2 July 16th 03 10:20 PM
TextBox.SetFocus steve Excel Programming 4 July 16th 03 07:40 PM


All times are GMT +1. The time now is 08:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"