The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Checkboxs
Posted: 11 Feb 08 11:18 AM
|
I am trying to pass a value to a field if there is a tick in the checkbox.
The MarketMon field is a checkbox, data type is SLX boolean Q3 has a string datatype and is a combo box
Sub cboMarketMon(Sender) IF cboMarketMon.Text = "T" THEN cboq3.Text = "Yes" cboq3.Enabled = False END IF End Sub
I am getting the following error message 'Microsoft VB script error type mismatch 'CboMarketMon' at line 25 char 5
line 25 char 5 in the code is 'IF cboMarketMon.Text = "T" THEN'
thanks
|
|
|
|
Re: Checkboxs
Posted: 11 Feb 08 1:20 PM
|
cboMarketMon is your sub name - not the name of the control the sub has no property. Your control is probably named chkMarketMon
you could probably get around this (if this sub is called from the chkbox click event) by re-writing as follows Sub cboMarketMon(Sender) IF SENDER.Text = "T" THEN cboq3.Text = "Yes" cboq3.Enabled = False END IF End Sub
|
|
|
|
Re: Checkboxs
Posted: 11 Feb 08 5:49 PM
|
the issue with checkboxes is until they are checked they are then once they are checked they are T and then unchecked they are F, you not handling the NULL in the DB value. |
|
|
|
Re: Checkboxs
Posted: 12 Feb 08 1:21 AM
|
I think that it is safer to use chkBox.Checked
|
|
|
|
Re: Checkboxs
Posted: 12 Feb 08 4:56 AM
|
applied your suggestion and it works! thanks |
|
|
|
Re: Checkboxs
Posted: 15 Feb 08 6:53 AM
|
Hi me again - As mentioned I applied your suggested code and it worked. However if the end user clicks on the checkbox by mistake then I want them to be able to click on the checkbox to remove the 'T' value and the value in cboq3 to be removed - a sort of a toggle, any suggestions would be appreciated. |
|
|
|
Re: Checkboxs
Posted: 15 Feb 08 8:44 AM
|
if (Sender.checked) then cboq3.text = "Yes" else cboq3.text = "no" end if cboq3.enabled = not sender.checked |
|
|
|