Changing the properties of a control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Quick question. I have a form with a control who's underlying table field has
it's "required" property set to yes. I also have a check box on the form that
I would like to use to change the controls required property to NO. Is the
only way to do this with code? If so I can only figure out the first half of
the code.

Private Sub chkActuals_Click()
If Me.chkActuals = True Then
'change cboWeeklyAllowance to Not required
End Sub

Thanks for any help!
 
As long as the field has been defined as required in the table, this cannot
be over-ridden at the form level.
The only option would be to changed Required = Yes to Required = No at the
table level and then put code in your form to check to see if the field has
or has not been provided.
 
That's what I needed to know, thanks!

Bill Edwards said:
As long as the field has been defined as required in the table, this cannot
be over-ridden at the form level.
The only option would be to changed Required = Yes to Required = No at the
table level and then put code in your form to check to see if the field has
or has not been provided.
 
Justin83716 said:
Quick question. I have a form with a control who's underlying table field has
it's "required" property set to yes. I also have a check box on the form that
I would like to use to change the controls required property to NO. Is the
only way to do this with code? If so I can only figure out the first half of
the code.

Private Sub chkActuals_Click()
If Me.chkActuals = True Then
'change cboWeeklyAllowance to Not required
End Sub


Not a reasonable idea. The required property applies to the
entire column in the table, not to any one specific row.

OTOH, you can use the **table** Validation Rule to check for
multiple field restrictions. Try removing the field's
Required property and use a table Validation Rule something
like:
[Actuals] Or [WeeklyAllowance] Is Not Null
 
Using the table validation rule for the field instead of the required
property seems like a good option to me. Rethinking the whole required
propety idea now I realize that it would not have worked for my purposes
anyway. Thanks to all for the helpful insights!

Marshall Barton said:
Justin83716 said:
Quick question. I have a form with a control who's underlying table field has
it's "required" property set to yes. I also have a check box on the form that
I would like to use to change the controls required property to NO. Is the
only way to do this with code? If so I can only figure out the first half of
the code.

Private Sub chkActuals_Click()
If Me.chkActuals = True Then
'change cboWeeklyAllowance to Not required
End Sub


Not a reasonable idea. The required property applies to the
entire column in the table, not to any one specific row.

OTOH, you can use the **table** Validation Rule to check for
multiple field restrictions. Try removing the field's
Required property and use a table Validation Rule something
like:
[Actuals] Or [WeeklyAllowance] Is Not Null
 

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

Back
Top