What's with this? (1 Viewer)

TheSearcher

Registered User.
Local time
Today, 03:49
Joined
Jul 21, 2011
Messages
411
I've been using the following code for the past twenty years. A few minutes ago I started getting an "Object doesn't support this property or method" error on the ctl.Value = null line. Any ideas?

Code:
Dim ctl As Control
For Each ctl In Me.Controls
    If ctl.Tag = "clear" Then ctl.Value = Null
Next
 
When the error occurs, in the Immediate window:
?ctl.Name
I bet you it is a control that does not have a Tag property.

Long shot: Maybe you have another Reference with a Control or Controls object. Change your code to:
Dim ctl As Access.Control

Also, do you have Option Explicit at the top of every module, and did you Debug > Compile your code?
 
I mistakenly was trying to clear a label. Interestingly, a label does have a tag property - but I guess it can't be used for this. Thanks tvanstiphout.
 

Users who are viewing this thread

Back
Top Bottom