Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 23rd, 2007, 07:52 AM
Registered User
 
Join Date: May 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Checkbox Caption

I am building a list of check boxes on an Access form programatically. But when I try to assign a caption to each checkbox, I get the error "Object doesn't support this property or method". The error occurs on the line where I try to set the caption property. I have also tried ".Text" with the same result. I am using Access 2003. Any help would be greatly appreciated.

Here is my code:

    With myCheckBox
         .Name = "cb" & i
         .Caption = "cb" & i ' error occurs on this line
         .Left = 100
         .Top = 100 + (i * 300)
         .Height = 200
         .Width = 200
     End With
 
Old May 23rd, 2007, 09:26 AM
Friend of Wrox
 
Join Date: Apr 2006
Posts: 159
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This could look like a stupid question, but are you trying to do this on the check box itself or on the label of the check box?
Cause if you are trying to do this on the check box itself, I don't think it can work cause you do not have a 'caption' property... On the label it should work cause there you have it...

 
Old May 23rd, 2007, 10:11 AM
Registered User
 
Join Date: May 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Vince,

Not a stupid question. I'm guessing that I need to create a checkbox AND a label separately based on your response. If this is the case, I suppose I have my answer. If not, please advise.

Thanks

Brian
 
Old May 25th, 2007, 07:05 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Vince is correct. The caption is a property of a label. You should not have to create a checkbox AND a label because when you create a checkbox, an associated label should appear with it.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Black a Caption Bar? jrahma C# 1 October 26th, 2008 07:40 AM
Caption Field Brendan Bartley Access 2 June 2nd, 2006 07:24 AM
saving changes to label caption Loralee Access 5 January 6th, 2006 09:53 PM
caption jlnashrod Access VBA 2 April 5th, 2004 10:48 PM
ToolWindow Caption Kep C# 0 February 24th, 2004 12:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.