Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2014
    Posts
    2

    Unanswered: Form Validation Rule

    Good Morning. I am working with Access 2010 on Windows XP. I am building a form for an internal team of mine that tracks outliers within a line of business.

    When a person goes to a break/lunch/leaves for the day, they are required to hand off the business they are watching to a co-worker with comments.

    I would my staff to be able to fill out all fields up to comments as a new record each time. IF they select a name from the Handed Off To list, COMMENTS must be filled out and submitted as a new records.

    These 2 options must be indepedent of each other. Any help in accomplishing this would be helpful.

    Here is some additional info that might help:

    Form Name: Daily Log Form
    Record Source: Daily Log Table

    Analyst Name = Analyst
    Line of Business Name = Line Of Business
    Day Name = Day
    Time Name = Time
    Comments Name = Comments
    Handed Off To Name = HandedOffTo
    Handoff Comments Name = HandoffComments
    Add Entry Button Name = AddEntryButton
    Attached Thumbnails Attached Thumbnails form.PNG  

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Quote Originally Posted by digitalrooke View Post
    IF they select a name from the Handed Off To list, COMMENTS must be filled out and submitted as a new records.
    I'm not sure to understand what you mean here.

    For the rest, you can always scan all the textbox controls on the form and check that they are not empty:
    Code:
    Dim ctl as Control
    
    For Each ctl In Me.Controls
        If ctl.ControlType = acTextbox Then
            If Len(Nz(Ctl.Value, "")) = 0 Then
                MsgBox ctl.Name " & cannot be empty.", vbExclamation, "Empty value"
                Ctl.SetFocus
                Exit For
            End If
        End If
    Next ctl
    In this example, a simple message box is used but you can manage what needs to be done in such situation in any way you see fit.
    Have a nice day!

  3. #3
    Join Date
    Apr 2014
    Posts
    2
    There are two things that could happen in this form. 1) The will fill out everything up through comments and it will be a NEW record 2) When they hand of the business to a co-worker, they will specify who they handed it off to and their comments and that will also be a NEW record

    One of the validation rules I would like is to stop the new record from being added if they select a name from the Handed Off To combo box and no comments are left. If the select a name they HAVE to leave comments.

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Is the form bound or unbound?
    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •