checkbox not saving

awake2424

Registered User.
Local time
Today, 15:58
Joined
Oct 31, 2007
Messages
479
If a checkbox on a form is selected then a few fields are visible. That seems to work, but when the database is closed and re-openend the edits are not saved in the record. The code is below. Thank you.

Code:
 Private Sub Form_Current()
    Me.Check275.Visible = Not IsNull(Me.Text246)

If Me.Check295 = -1 Then
        Me.Text281.Visible = True
        Me.Text285.Visible = True
        Me.Text287.Visible = True
        Me.Text289.Visible = True
        Me.AddDate.Visible = True
        Me.AddDate = Date
If Me.Dirty Then    'Save any edits.
        Me.Dirty = False
    End If
    
    Else
        Me.Text281.Visible = False
        Me.Text285.Visible = False
        Me.Text287.Visible = False
        Me.Text289.Visible = False
        Me.AddDate.Visible = False
        Me.Text281.Value = Null
        Me.Text285.Value = Null
        Me.Text287.Value = Null
        Me.AddDate.Value = Null
    End If
End Sub

Code:
 Private Sub Check295_AfterUpdate()
If Me.Check295 = -1 Then
        Me.Text281.Visible = True
        Me.Text285.Visible = True
        Me.Text287.Visible = True
        Me.Text289.Visible = True
        Me.AddDate.Visible = True
        Me.AddDate = Date
If Me.Dirty Then    'Save any edits.
        Me.Dirty = False
    End If
    
    Else
        Me.Text281.Visible = False
        Me.Text285.Visible = False
        Me.Text287.Visible = False
        Me.Text289.Visible = False
        Me.AddDate.Visible = False
        Me.Text281.Value = Null
        Me.Text285.Value = Null
        Me.Text287.Value = Null
        Me.AddDate.Value = Null
    End If
End Sub

Thanks.
 
The checkbox would need to be bound to a yes/no field in the table. Is it?
 

Users who are viewing this thread

Back
Top Bottom