|
-
November 27th, 1998, 12:19 PM
#3
Re: Binding option buttons to data
Tim-
The best way I have found is to bind the field to a HIDDEN text box, and use events to tie it to a checkbox.
For example:
'' Triggered by user action
Private Sub Check1_Click()
'' Use 1 for checked, 0 for unchecked
If (Check1.Value = vbChecked) Then
Text1.Text = "1"
Else
Text1.Text = "0"
End If
End Sub
'' Triggered by record refresh
Private Sub Text1_Change()
If (Text1.Text = "1") Then
Check1.Value = vbChecked
Else
Check1.Value = vbUnchecked
End If
End Sub
You may think that this would cause an endless loop, but VB stops firing events if the data doesn't change.
This also allows you to make a "Y/N" (character) field into a checkbox.
-Jim
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|