Can't change value in OptionGroup

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi everyone
Can you perhaps explain why I can't set the value of an Option Group (called
FrameProgress) within the 'On Current' event? I've got quite a bit of code
on this event and below is the offending portion. I get a runtime error of
'-2147352567 (80020009)'. The control is enabled and not locked and the form
allows edits and additions. Any idea what the problem is?

ElseIf frameStatus = 5 And frameProgress > 3 And Me.chkOther = True Then
txtProgress.Value = "5"
boxStatus.BackColor = 10092543 'yellow
lblp1.BackColor = 10092543
lblp2.BackColor = 10092543
lblp3.BackColor = 10092543
lblp4.BackColor = 10092543
lblp5.BackColor = 10092543
lblp6.BackColor = 15527148 'grey
lblp7.BackColor = 15527148
lblp8.BackColor = 15527148
frameProgress = 5
lblStatus1.Value = "IN PROGRESS - Stage 5 complete"
lblStatus1.BackColor = 10092543
Me.Form.Refresh
Exit Sub

Many thanks for any help you can give.

Regards,

Lee
 
Are you sure that setting the value of the option group is causing the
trouble?
I'd be highly suspicious of calling Me.Refresh in On_Current.
 
Perhaps you could place a breakpoint at the beginning of the procedure and
step through it until it errors.
Let us know which line is causing the error.
 
Thanks for your input. I finally worked out what was happening with this.
The On_Current event doesn't like it if the code attempts to change the
value in frameProgress when it's already set to the stated value. To avoid
this, I've added further code at each Progress point which basically states
"if the status/progress is already this then change the appearance of the
form but don't alter any values..." (if you see what I mean). This has
doubled the size of the On_Current event but at least it works now!

Kind regards,

Lee
 
Back
Top