unable to set a checkbox value...

B

Brad Pears

On the load event of a sub form, I am attempting to set a checkmark value
based on teh value of a checkmark on teh subform... I am getting an error
indicating that "you can't assign a value to this object". The checkbox
control is not locked and is enabled.

Here is the code I have in the load event of the subform...

If Not IsNull(Forms![frmPricing].chkCustom) Then
Me.chkCustom.Value = Forms![frmPricing].[chkCustom]
End If

Where frmPricing.chkCustom is the control from the main form and
me.chkCustom is the control located on the subform, whose value I want to
set.

Help!

Thanks,

Brad
 
B

Brendan Reynolds

The Load event of a subform fires *before* the Load event of the parent
form, so at that point the controls on the parent form are not available.
Try using the Load event of the parent form, or if you are dynamically
swapping subforms, add the code to set the check box to the same code that
swaps the subforms. In other words, if you have a command button on the
parent form that assigns a form name to the SourceObject property of the
subform control, add the code to set the check box to the Click event of
that command button.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top