Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Controls.ControlType

Status
Not open for further replies.

asjohnson

Technical User
Mar 8, 2001
15
0
0
US
I added a procedure that loops through all controls on a form to see if the Value changed (from the OldValue property). I was using a Control variable(dim ctl as Control) to represent each control on the form. When I tried to use the Control Type property, I receive an error. The help in Access mentions this ControlType property is available. Am I missing a reference?
 
You may require a reference to MS DAO 3.6 Object Library.
If You don't have it, add it and try to compile. If it still won't, bump it's position up a notch or two. Try it?! Gord
ghubbell@total.net
 
Still did not work. I have the reference at the top. Part of my code:

dim ctl as Control

for each ctl in Me.Controls
ctl.ControlType
ctl.OldValue
...
next

What is strange is when I compile I receive no errors. But I receive errors in the Error Handler.
 
Here's a quick one just to check (it changes colors...)

Dim ctl As Control
For Each ctl In Forms!YourFormName
If ctl.ControlType = acToggleButton Then
If ctl.Value = -1 Then
ctl.ForeColor = 32768
Else
ctl.ForeColor = vbRed
End If
End If
Next ctl
Me.Repaint Gord
ghubbell@total.net
 
Is that a typo or shouldn't that be Me!Controls? Terry M. Hoey
th3856@txmail.sbc.com
While I don't mind e-mail messages, please post all questions in these forums for the benefit of all members.
 
I must be missing something because when I type ctl.cont... the shortcut menu appears but the ControlType property is not listed. Is there another reference?

I am using 97, not 2000, too.
 
Did the site go down or was it just my head hitting the desk again?...
In 97 I have: VB for Apps
Access 8.0
DAO 3.5
in that order. Try that perhaps? Gord
ghubbell@total.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top