ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   timing sensetive code? (https://www.excelbanter.com/excel-programming/405353-timing-sensetive-code.html)

TimK

timing sensetive code?
 
I have a module based subroutine which is activated by a button on a button
bar. The code loads a userform and initializes it with data before making it
visible for entry and changes. The problem I'm seeing is that my
initialization actions don't appear to work when I run normally, but when I
trap the execution and step through it, everything is working as it should,
i.e. all data is transfered as desired. But when I run it full speed, the
userform comes up blank as if not of the transfers took place. A snippet of
code from this module based code is shown below. I haven't a clue what could
be causing this problem.....

If usePS Then
.TextBox27.Value = psws.Cells(p.BuildID, usercol) 'build id
.ComboBox8.Value = psws.Cells(p.Priority, usercol) 'Priority
.ComboBox25.Value = psws.Cells(p.Sprint, usercol) 'Sprint Par found
.ComboBox9.Value = psws.Cells(p.Status, usercol) 'Status
.ComboBox3.Value = psws.Cells(p.Detect, usercol) 'detection
activity
.ComboBox17.Value = psws.Cells(p.ReTestedBy, usercol) 'ReTested By
.ComboBox28.Value = psws.Cells(p.Test, usercol) 'Test case
Else
.TextBox27.Value = ""
.ComboBox25.Value = ""
.ComboBox8.Value = "" ' having a timing problem with above
sets...
.ComboBox9.Value = ""
.ComboBox3.Value = ""
.ComboBox17.Value = ""
.ComboBox28.Value = ""
End If

Nigel[_2_]

timing sensetive code?
 
Try firing your initialization actions from the UserForm initialize event.
So the sequence is

Load UserForm
Initialize the controls from the UF Initialize event
UserForm Show

--

Regards,
Nigel




"TimK" wrote in message
...
I have a module based subroutine which is activated by a button on a button
bar. The code loads a userform and initializes it with data before making
it
visible for entry and changes. The problem I'm seeing is that my
initialization actions don't appear to work when I run normally, but when
I
trap the execution and step through it, everything is working as it
should,
i.e. all data is transfered as desired. But when I run it full speed, the
userform comes up blank as if not of the transfers took place. A snippet
of
code from this module based code is shown below. I haven't a clue what
could
be causing this problem.....

If usePS Then
.TextBox27.Value = psws.Cells(p.BuildID, usercol) 'build id
.ComboBox8.Value = psws.Cells(p.Priority, usercol) 'Priority
.ComboBox25.Value = psws.Cells(p.Sprint, usercol) 'Sprint Par
found
.ComboBox9.Value = psws.Cells(p.Status, usercol) 'Status
.ComboBox3.Value = psws.Cells(p.Detect, usercol) 'detection
activity
.ComboBox17.Value = psws.Cells(p.ReTestedBy, usercol) 'ReTested By
.ComboBox28.Value = psws.Cells(p.Test, usercol) 'Test case
Else
.TextBox27.Value = ""
.ComboBox25.Value = ""
.ComboBox8.Value = "" ' having a timing problem with above
sets...
.ComboBox9.Value = ""
.ComboBox3.Value = ""
.ComboBox17.Value = ""
.ComboBox28.Value = ""
End If



TimK

timing sensetive code?
 
Good Idea. I moved all the .controlsource initializing statements to the
_initialize event and it now works. Thanks.

"Nigel" wrote:

Try firing your initialization actions from the UserForm initialize event.
So the sequence is

Load UserForm
Initialize the controls from the UF Initialize event
UserForm Show

--

Regards,
Nigel




"TimK" wrote in message
...
I have a module based subroutine which is activated by a button on a button
bar. The code loads a userform and initializes it with data before making
it
visible for entry and changes. The problem I'm seeing is that my
initialization actions don't appear to work when I run normally, but when
I
trap the execution and step through it, everything is working as it
should,
i.e. all data is transfered as desired. But when I run it full speed, the
userform comes up blank as if not of the transfers took place. A snippet
of
code from this module based code is shown below. I haven't a clue what
could
be causing this problem.....

If usePS Then
.TextBox27.Value = psws.Cells(p.BuildID, usercol) 'build id
.ComboBox8.Value = psws.Cells(p.Priority, usercol) 'Priority
.ComboBox25.Value = psws.Cells(p.Sprint, usercol) 'Sprint Par
found
.ComboBox9.Value = psws.Cells(p.Status, usercol) 'Status
.ComboBox3.Value = psws.Cells(p.Detect, usercol) 'detection
activity
.ComboBox17.Value = psws.Cells(p.ReTestedBy, usercol) 'ReTested By
.ComboBox28.Value = psws.Cells(p.Test, usercol) 'Test case
Else
.TextBox27.Value = ""
.ComboBox25.Value = ""
.ComboBox8.Value = "" ' having a timing problem with above
sets...
.ComboBox9.Value = ""
.ComboBox3.Value = ""
.ComboBox17.Value = ""
.ComboBox28.Value = ""
End If




All times are GMT +1. The time now is 06:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com