M
Merkling, Steven
I am connecting to an Access Database with ADO
I have a small issue when trying to set the value of a checkbox on a form
ADO returns True and False from the database
The checkbox wants vbChecked and vbUnchecked
The True keyword has a value equal to -1.
The False keyword has a value equal to 0.
The vbChecked keyword has a value equal to 1.
The vbUnchecked keyword has a value equal to 0.
I created my own function that is listed bellow but I was wondering
1) Is there a built in function that converts these?
2) Is there a setting either in the database or on my checkbox that I can make the checkbox and ADO field compatible?
3) Looking at it I could just multiply it by -1 and it would come out too. Is this a valid solution?
Private Function CheckBoxValueFromBoolean(ValueToConvert As Boolean) As Integer
'Translate ValueToConvert
If ValueToConvert = True Then
CheckBoxValueFromBoolean = vbChecked
Else
CheckBoxValueFromBoolean = vbUnchecked
End If
End Function
Thanks in Advance
-Merk
I have a small issue when trying to set the value of a checkbox on a form
ADO returns True and False from the database
The checkbox wants vbChecked and vbUnchecked
The True keyword has a value equal to -1.
The False keyword has a value equal to 0.
The vbChecked keyword has a value equal to 1.
The vbUnchecked keyword has a value equal to 0.
I created my own function that is listed bellow but I was wondering
1) Is there a built in function that converts these?
2) Is there a setting either in the database or on my checkbox that I can make the checkbox and ADO field compatible?
3) Looking at it I could just multiply it by -1 and it would come out too. Is this a valid solution?
Private Function CheckBoxValueFromBoolean(ValueToConvert As Boolean) As Integer
'Translate ValueToConvert
If ValueToConvert = True Then
CheckBoxValueFromBoolean = vbChecked
Else
CheckBoxValueFromBoolean = vbUnchecked
End If
End Function
Thanks in Advance
-Merk