pwatson
Jul 12 2005, 04:29 PM
I'm working with some sample code, that is written as:
dim ctl as Control
ctl.Caption = "okely dokely."
When I try to code this, ctl does not have a caption property.
I'm wondering if the code was written for a different version of Access than the one I'm using, or if it won't let you set a caption unless you're specifically dealing with a label?
Any insights?
Thanks,
Paul
NoahP
Jul 12 2005, 04:35 PM
A label IS a control, at least it is part of the Forms Collection.
Noah
freakazeud
Jul 12 2005, 04:39 PM
Hi,
try:
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.ControlType = acLabel Then
ctl.Caption = "youcaption"
End If
Next ctl
HTH
Good luck
GlenKruger
Jul 12 2005, 06:02 PM
Try:
dim ctl as Control
ctl =Me.SomeControl 'Where Some Control is the control you want to change the caption of
ctl.Caption = "okely dokely."
Or simply use the:
Me.SomeControl.Caption = "okely dokely."
In the event that you want to change the controls caption.
PS..... There are only controls on a form Fields are in Tables.
Edited by: GlenKruger on Tue Jul 12 19:11:14 EDT 2005.
pwatson
Jul 13 2005, 08:28 AM
Thanks, guys.
Using "dim ctl as Control" , when I'm tying this code, as soon as I type "ctl.", a list of control properties and methods pop up. "Caption" is not included in the list. I figured since it wasn't there, I was doing something wrong. I guess there are circumstances when not all of the methods/properties available are displayed?
Paul
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.