Default Value

G

Guest

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
 
G

Guest

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.
 
G

Guest

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
 

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