PC Review


Reply
Thread Tools Rate Thread

Crash on BackColor Reset

 
 
=?Utf-8?B?RGF2aWQgSGFiZXJjb20=?=
Guest
Posts: n/a
 
      25th Apr 2006
Using code from Dirk Goldgar to reset all TextBoxes to Null after a cancel,
I have attempted to add code which also resets the BackColor of certain
previously changed controls. My added code works fine up to the point after
the last mis-colored control is reset, but then it crashes with the message
"Object doesn't support this property or method." Since all the affected
controls have been reset at that point, I can't see why this happens. Can
someone point me in the right direction?

Dim ctl As Access.Control
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
ctl.Value = Null
'If req'd field set to Lt Red, reset to Lt Yellow
If ctl.BackColor = "13408767" Then
ctl.BackColor = "10092543"
End If
End If
Next ctl

Thanks in advance.
--
David Habercom
University of Tennessee
 
Reply With Quote
 
 
 
 
=?Utf-8?B?RGF2aWQgSGFiZXJjb20=?=
Guest
Posts: n/a
 
      25th Apr 2006
My apologies! To simplify my post, I did not include all three If
ControlType conditions. My actual conditions include "Or ctl.ControlType =
acCheckBox." Check boxes do not have a BackColor option, thus the crash.
The solution was to move the BackColor code to a 2nd If ControlType
(following the first) which excludes acCheckBox.

I frequently discover my own error while writing a post to these groups, but
this time I figured it out too late!

Thanks (for you patience.)
--
David Habercom
University of Tennessee

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
IE 6.0 toolbars reset after crash andenterprises@gmail.com Windows XP Internet Explorer 5 20th Jul 2006 04:33 PM
Crash on BackColor Reset =?Utf-8?B?RGF2aWQgSGFiZXJjb20=?= Microsoft Access Form Coding 0 24th Apr 2006 09:28 PM
Toolbars reset to default after a crash. =?Utf-8?B?Q2h1Y2sgU3R1ZGVy?= Microsoft Excel Worksheet Functions 2 9th Mar 2006 11:08 PM
Reset Passwords after system crash =?Utf-8?B?dGtpcmtwYXRyaWNr?= Windows XP General 1 15th Oct 2005 10:03 AM
Crash and Explorer reset? Christopher Vitek Windows XP Help 0 11th Feb 2004 04:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:52 PM.