Hello, I found this code elsewhere on this board and was able to manipulate it for my db, so it pops up a message box with what fields still need information. my problem is that i want this to happen when i click a checkbox. my checkbox already disables all of the other fields though, so that you cannot update the information.
is there a way to change this so it will only disable the boxes if the information is entered, and not disable them if they are blank?
example:
I leave field1 blank, when i click the checkbox it will say "please fill in field1" then lets me go back to change it INSTEAD of making it diabled?
Thank you,
BionicMan
Here is my code (please bear with me, i know VERY little about coding)
is there a way to change this so it will only disable the boxes if the information is entered, and not disable them if they are blank?
example:
I leave field1 blank, when i click the checkbox it will say "please fill in field1" then lets me go back to change it INSTEAD of making it diabled?
Thank you,
BionicMan
Here is my code (please bear with me, i know VERY little about coding)
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
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
End If
End If
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