Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default Spin button timing

Hello,

My problem is illustrated here with a form that contains a textbox and
a spin button. The spin button updates the variable Mnth, sub
FormRefresh updates the form with new values, and returns the focus to
the text box.. However, focus isn't always returned to the text box,
in fact it flip-flops between staying on the spin button and and
returning to the text box.. If I insert a breakpoint or a message box
anywhere in the loop, it works the way I expect it too, so I suspect
this is a timing issue. However, inserting Waits or other delay
tactics doesn't seem to fix it. Appreciate any suggestions, thanks.
Regards,

DaveU

Private Sub spnDate_Change()
Mnth = spnDate.Value
Call FormRefresh
End Sub

Sub FormRefresh()
'
' code here that updates myForm according to Mnth value
'
myForm.txtEntry.SetFocus

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Spin button timing

Dave Unger wrote:
Hello,

My problem is illustrated here with a form that contains a textbox and
a spin button. The spin button updates the variable Mnth, sub
FormRefresh updates the form with new values, and returns the focus to
the text box.. However, focus isn't always returned to the text box,
in fact it flip-flops between staying on the spin button and and
returning to the text box.. If I insert a breakpoint or a message box
anywhere in the loop, it works the way I expect it too, so I suspect
this is a timing issue. However, inserting Waits or other delay
tactics doesn't seem to fix it. Appreciate any suggestions, thanks.
Regards,

DaveU

Private Sub spnDate_Change()
Mnth = spnDate.Value
Call FormRefresh
End Sub

Sub FormRefresh()
'
' code here that updates myForm according to Mnth value
'
myForm.txtEntry.SetFocus

End Sub




Try this it works for me. Phillip London UK

Private Sub Spndate_Change()
FormRefresh
Me.Spndate.SetFocus
Me.txtentry.SetFocus
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default Spin button timing

Hi Phillip ,

Thanks for taking the time to look at this - your solution works
perfectly, but I have to admit I don't understand why. The
Me.Spndate.SetFocus almost seems redundant, surely it already has the
focus by virtue of the fact that it was clicked by the mouse. And
Me.txtentry.SetFocus is pretty much what I was doing later on in a
subsequent routine. And yet your code works and mine doesn't - I'm
obviously missing something here. I'd be interested to hear any
explanation you have on this. Thanks for now,

regards,

DaveU

Phillip wrote:
Dave Unger wrote:
Hello,

My problem is illustrated here with a form that contains a textbox and
a spin button. The spin button updates the variable Mnth, sub
FormRefresh updates the form with new values, and returns the focus to
the text box.. However, focus isn't always returned to the text box,
in fact it flip-flops between staying on the spin button and and
returning to the text box.. If I insert a breakpoint or a message box
anywhere in the loop, it works the way I expect it too, so I suspect
this is a timing issue. However, inserting Waits or other delay
tactics doesn't seem to fix it. Appreciate any suggestions, thanks.
Regards,

DaveU

Private Sub spnDate_Change()
Mnth = spnDate.Value
Call FormRefresh
End Sub

Sub FormRefresh()
'
' code here that updates myForm according to Mnth value
'
myForm.txtEntry.SetFocus

End Sub




Try this it works for me. Phillip London UK

Private Sub Spndate_Change()
FormRefresh
Me.Spndate.SetFocus
Me.txtentry.SetFocus
End Sub


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
Spin Button [email protected] Excel Programming 4 June 12th 05 07:43 PM
spin button value tina Excel Discussion (Misc queries) 2 March 17th 05 02:11 PM
spin button bruce forster Excel Programming 1 May 7th 04 12:21 AM
Spin Button... scottnshelly[_25_] Excel Programming 4 April 30th 04 07:49 AM
Spin Button Andrew[_14_] Excel Programming 1 July 18th 03 01:51 AM


All times are GMT +1. The time now is 08:44 PM.

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"