Resetting a Checkbox

bionicman

Registered User.
Local time
Today, 06:10
Joined
Jul 22, 2003
Messages
145
ACK! help please

ok, to start here is my code:
Code:
Private Sub Form_Current()
If Resolved = True Then
    Comment.Enabled = False
    Resolution.Enabled = False
    Appointment_Date.Enabled = False
    Appointment_Time.Enabled = False
    Comment_Date.Enabled = False
    First_Name.Enabled = False
    Last_Name.Enabled = False
    Medicaid__.Enabled = False
    Trip__.Enabled = False
Else
    Comment.Enabled = True
    Resolution.Enabled = True
    Appointment_Date.Enabled = True
    Appointment_Time.Enabled = True
    Comment_Date.Enabled = True
    First_Name.Enabled = True
    Last_Name.Enabled = True
    Medicaid__.Enabled = True
    Trip__.Enabled = True
End If

If IsNull([Resolution]) = True Then
    Resolved.Enabled = False
Else
    Resolved.Enabled = True
End If

If Left([Trip__], 3) = "DMS" Or Left([Trip__], 3) = "USA" Then
    Check23.Visible = True
Else
    Check23.Visible = False
End If

If Check23 = True Then
    Text25.Visible = True
Else
    Text25.Visible = False
End If
End Sub
Private Sub Resolved_Click()
If Resolved = True Then
    Comment.Enabled = False
    Resolution.Enabled = False
    Appointment_Date.Enabled = False
    Appointment_Time.Enabled = False
    Comment_Date.Enabled = False
    First_Name.Enabled = False
    Last_Name.Enabled = False
    Medicaid__.Enabled = False
    Trip__.Enabled = False
Else
    Comment.Enabled = True
    Resolution.Enabled = True
    Appointment_Date.Enabled = True
    Appointment_Time.Enabled = True
    Comment_Date.Enabled = True
    First_Name.Enabled = True
    Last_Name.Enabled = True
    Medicaid__.Enabled = True
    Trip__.Enabled = True
End If


If Resolved.Value = True Then
    Dim strFields As String
    strFields = checkFields
    If strFields <> "" Then
        MsgBox "Please fill in the following fields:" & vbNewLine & vbNewLine & strFields
        Cancel = True
    GoTo inputinfo
    Else: GoTo final
    End If
End If

inputinfo:
    Comment.Enabled = True
    Resolution.Enabled = True
    Appointment_Date.Enabled = True
    Appointment_Time.Enabled = True
    Comment_Date.Enabled = True
    First_Name.Enabled = True
    Last_Name.Enabled = True
    Medicaid__.Enabled = True
    Trip__.Enabled = True
    Trip__.SetFocus
    Resolved.Value = False

final:
End Sub
Private Sub Resolution_AfterUpdate()
If IsNull([Resolution]) = True Then
    Resolved.Enabled = False
Else
    Resolved.Enabled = True
End If
End Sub

Function checkFields() As String
    If IsNull(Me.Trip__) Then
        checkFields = addToString(checkFields, "Trip #")
    End If
    If IsNull(Me.Comment_Date) Then
        checkFields = addToString(checkFields, "Comment Date")
    End If
    If IsNull(Me.Last_Name) Then
        checkFields = addToString(checkFields, "Last Name")
    End If
    If IsNull(Me.First_Name) Then
        checkFields = addToString(checkFields, "First Name")
    End If
    If IsNull(Me.Medicaid__) Then
        checkFields = addToString(checkFields, "Medicaid #")
    End If
    If IsNull(Me.Appointment_Date) Then
        checkFields = addToString(checkFields, "Appointment Date")
    End If
    If IsNull(Me.Appointment_Time) Then
        checkFields = addToString(checkFields, "Appointment Time")
    End If
    If IsNull(Me.Comment) Then
        checkFields = addToString(checkFields, "Comment")
    End If
End Function

Function addToString(strOrig As String, strToAdd As String) As String
    If strOrig = "" Then
        addToString = strToAdd
    Else
        addToString = strOrig & vbNewLine & strToAdd
    End If
End Function

Private Sub Check23_Click()
If Check23 = True Then
    Text25.Visible = True
Else
    Text25.Visible = False
End If
End Sub

Here is my problem...
Code:
If Left([Trip__], 3) = "DMS" Or Left([Trip__], 3) = "USA" Then
    Check23.Visible = True
Else
    Check23.Visible = False
End If

If Check23 = True Then
    Text25.Visible = True
Else
    Text25.Visible = False
End If

check23 is not resetting on each record, it is holding it's value. If it is checked on one record, it is checked on all where it should be visible.

I am not too good with coding, but i am trying to learn. any help would be appreciated.

Thank you!
 
Is anyone able to help me with this please? I know it has to be something simple, as i said, i am still trying to learn coding.

I have another checkbox on the form that works perfectly, i don't understand what the problem is?!

Thank you!
 
OK, i got it.... boy do i feel dumb. I forgot to add those fields in my table, so it had nothing to reference with :) whoops :)
 

Users who are viewing this thread

Back
Top Bottom