I have the following two fields (among others) on my form:
1. Checkbox called "Script Required?"
2. Combo box with a choice of services.
Some services require scripts and others do not. The default value for the
checkbox is yes since more do than don't. What I would like is that if the
service choice from the combo box does not require a script, then the
checkbox converts to no. Is that possible?
Thanks,
Sandra
Dennis - 19 Oct 2007 19:30 GMT
In the ON CHANGE event of your combo-box, insert code similar to:
Select Case CombBoxValue
Case This, That, SomethingElse
Me.Checkbox = 0
Case Else
Me.Checkbox = -1
End Select
Fiddle with it a bit, but that's essentially what you need. Be sure to
single-step through the code to make sure the CASE works for all values.
> I have the following two fields (among others) on my form:
>
[quoted text clipped - 10 lines]
>
> Sandra
Steve Sanford - 21 Oct 2007 22:56 GMT
If the Row Source of the combo box is a query, you can add a field (Y/N -
boolean) to the table that would indicate if the service needs a script.
If you want to know if a service needs a script, query the table. There is
no chance of someone accidently changing the state of the checkbox.
If you still want to keep the checkbox, it can set it using the column
property.
If the combo box row source fields were
lngServicesID (PK) (long)
txtServiceDesc (text)
ynScriptRequired (boolean)
and the control names are RequireScript (check box) and cboService (combo box)
then the checkbox could be set/unset using
Sub cboService_Afterupdate()
' the column property is zero based. The first column is numbered 0
Me.RequireScript = Me.cboService.Column(2)
End Sub
Just another way to remove the cat from its skin
HTH

Signature
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)
> I have the following two fields (among others) on my form:
>
[quoted text clipped - 10 lines]
>
> Sandra