listbox header in subform

P

pjgalloway

I have a listbox called lstSampleData and a checkbox called
chkColumnHeadings. When the user clicks the checkbox I turn the ColumnHeads
property on and off with the following code in the on click event for
chkColumnHeadings:

lstSampleData.ColumnHeads = chkColumnHeadings

It works fine and dandy in a form. The display is changed on the listbox to
reflect whether or not ColumnHeads is currently set to true.

My problem is that I need this to be a subform in another form. As soon as
I make it a subform I can not get the display to change to reflect the value
of lstSampleData.ColumnHeads. It will only reflect the design value even
though I can verify through debug window that I am successfully changing the
value.

Is this a "feature" of listboxes on subforms or is there a trick to changing
the ColumnHeads property? Is my only option to create two listboxes, one
with column heads and one without and just choosing which one to display?
 
E

Eric D via AccessMonster.com

You need to point your code to focus on the subform. Access doesn't know
whether your want something done to the mainform (parent) or the subform so
unless you tell it the subform, Access will assume your working with the
mainform.

Look in Help. Search SubForm and then Form Property. The Remarks section
should explain this for you.
 
P

pjgalloway

That is code in the subform. The value for lstSampleData.ColumnHeads is
changed but the display of the listbox does not show the nice line that
indicates a header row.
 
Top