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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

putting checkboxes into a listbox 1

Status
Not open for further replies.

Twiddler

Technical User
Jan 11, 2004
7
0
0
US
Hello,

I'm making a form and have it almost complete, but I'm having trouble putting checkboxes with text and perhaps a couple other columns in a listbox. And, I'm not sure if a listbox is even the proper control to use.

The data from a source will be displayed with a check box next to it so that the user can select it for further transfer etc. if applicable. The number of items (locomotive failures) listed would vary. If I could have a scroll bar as needed, that would be best.

I can't seem to find good information on addcontrol.

Keith
 
Take a look at the following properties of your listbox:
MultiSelect (should be frmMultiSelectMulti or fmMultiSelectExtended)
ListStyle (should be fmListStyleOption)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks PHV for the suggestion, but I still seem to be missing something.

I have scoured the help files and the closest I can get is this:

On my userform_initialize:

Dim CheckBox10 As Control

And in one of the private subs:

Dim CheckBox10 As Control
Set CheckBox10 = Controls.Add("MSForms.CheckBox.1")
CheckBox10.Tag = "This is Checkbox10"

Is this way off?

If I can add a checkbox to a listbox in design mode, shouldn't I be able to do it programmaticly?
 
Just realized that I made two errors in that previous post...

First, I DIMed my control twice,

Second, I never specified that the checkbox is supposed to go into ListBox1.
 
If I can add a checkbox to a listbox in design mode
How do you do that ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I have a similar requirement. I'm just adding on to this thread for those who may come across this:
1. Table - ensure that the Display Control property (found in the Lookup tab) of the Yes/No data type is CheckBox
2. Query - create a query based on the table and select desired fields.
3. Form - drag the (newly created) Query icon into a form. Access will automatically create a subform for you and inherit the Display Control Property of the table.

Regards,

Jason
 
I found the step that I was missing. I never changed the columncount property and didn't understand the concept of altering an array, then making the .List property equal to it.

Once I performed the steps suggested by PHV above and figured out how I was going about it the wrong way, I was able to make it work quite well.

Thanks for the attempted help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top