Require text if a checkbox is clicked.

tazijake

New member
Local time
Today, 06:44
Joined
Oct 2, 2012
Messages
8
Hello everyone!

I have a form which is tracking a process and as each step is completed, the user clicks a checkbox to activate the textbox where they can enter the date the step was completed.

If they click the checkbox to activate the textbox, I want to ensure that the textbox is completed. I have created a check in my form's BeforeUpdate event so that a message box pops up if they didn't complete an activated box, but I'm missing the part which sends them back to that textbox and does not allow them to save that record.

With my code, the message box pops up correctly, but then I can still move on without forcing the text:

If [ckStatusIssued] = False Then
[txtBatchIssueDate] = IsNotNull
Else
MsgBox ("Enter Date Record was Issued or Uncheck the box next to 'Issued'")
End If

Thanks for any help!
 
Untested "Air Code" but perhaps something like this in the Before Update event of the form:
Code:
If Me.ckStatusIssued = True AND IsNull(Me.txtBatchIssueDate) Then
  MsgBox ("Enter Date Record was Issued or Uncheck the box next to 'Issued'")
  Cancel = True
  Me.txtBatchIssueDate.SetFocus
End If
 
The checkbox is redundant because its status can be derived from presence or absence of a date in a specific field.

A StepXCompleted textbox is enough.
 
Thank you!

I see what you are both saying as far as the redundancy, but it will serve as a visual cue (and, in essence, a 2nd check) to ensure that the user is filling in the correct field and then ensuring that they follow through on the step with the requirement that you helped me build.

I appreciate it.
 
No not really. The entire functionality envisaged by you can be satisfied by having a StepXCompletedDate field, filled or not. You are just adding complexity and code (for no really good reason) :D
 
Is a StepXCompletedDate field something else or do you mean that if that field is complete, obviously that step is done?

When I say a 2nd check or visual cue, I'm speaking specifically on the user end. If I were creating this database for my own use, a complete date would be sufficient, however, I have to consider my users in this database.

If the sole purpose is to ensure they pay a little more attention, then that's good enough reason for us.

Thanks again for your help
 

Users who are viewing this thread

Back
Top Bottom