[Ace] Save check boxes into MS Access' database ! Yes ! It's true !
Converts VB checkbox control values(checked/unchecked) into MS ACCESS value (0,-1) and vice versa. I came across this while I was doing my project. Seems like MS ACCESS doesn't support checkbox values yet. I couldn't find anything like it here in planet source code therefore I wrote this. I played around with MS A's boolean controls, and found out it returns values 0,-1.(not 0,1? )There for, I scribbled this up. Need to finish my project quick, hehe.Btw, if you guys have a better solution, or if there IS a solution, pls contact me, :P If you're using this code, pls credit me for my work, and vote for me !
AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
'Wonder why MS Access doesn't support this ?
'Manually converting access -1,0 to checkbox true/false value
'This procedure can be declare eithr in main form or a module
'When viewing data, MS ACcess value (0,-1) are changed into
'checkbox controls' (true/false) to be displayed.
Sub keydrop_check(keydrop)
Dim Room_found As Boolean
Room_found = False
With datrooms.Recordset
.MoveFirst
Do While Room_found = False And Not .EOF
If .Fields("Room No") = DatCheckin.Recordset.Fields("Room") Then
keydrop = .Fields("keydrop")
Room_found = True
Else:
.MoveNext
End If
Loop
End With
If keydrop = 0 Then
chkKeydrop = Unchecked
Else: chkKeydrop = Checked
End If
End Sub
'This is the click event for the checkbox
'
'Converts check/uncheck value into 0/-1
' and stores it back into MS Access DB
Private Sub chkKeydrop_Click()
datrooms.Recordset.Edit
If chkKeydrop = Checked Then
keydrop = -1
datrooms.Recordset.Edit
datrooms.Recordset.Fields("Keydrop").Value = "-1"
datrooms.Recordset.Update
Else:
keydrop = 0
datrooms.Recordset.Edit
datrooms.Recordset.Fields("Keydrop").Value = "0"
datrooms.Recordset.Update
End If
End Sub