Results 1 to 3 of 3
  1. #1
    Jimruns919 is offline Advanced Beginner
    Windows 10 Access 2019
    Join Date
    Jun 2023
    Location
    Pennsylvania
    Posts
    32

    Making a field required

    I am making a Work Order system for my company. What I am trying to do is that if the AssignedTo field is not empty, then the DateScheduled field is required.



    I think its a VBA NotNull command but I am not sure and what I have tried is not working.

  2. #2
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    Probably something like this in the form before update event

    Code:
        If Not IsNull(Me.AssignedTo) And IsNull(Me.DateScheduled) Then
            MsgBox "DateScheduled is a required field"
            Cancel = True
            Me.DateScheduled.SetFocus
        End If
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  3. #3
    Jimruns919 is offline Advanced Beginner
    Windows 10 Access 2019
    Join Date
    Jun 2023
    Location
    Pennsylvania
    Posts
    32
    That didn't work. I used the BEFORE UPDATE on the Date Scheduled field in the form because the work order will be created. Then it will need to be assigned later, so someone will go into the form later and assign it to someone.

    When it gets assigned I want them to need to put in a date and then the status goes to assigned, but I did figure it out based on your reply, so Thank You!

    I used the Assignedto field and did this:

    sub AssignedTo_AfterUpdate()

    if not isnull(me.assignedto) then
    me.datescheduled = date
    me.jobstatus = "assigned"

    end if


    and that worked!!!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 11-02-2018, 02:29 PM
  2. Making Field Required on a Form
    By KBNETGUY in forum Programming
    Replies: 3
    Last Post: 04-12-2018, 10:45 AM
  3. Replies: 4
    Last Post: 06-29-2015, 01:56 PM
  4. Replies: 10
    Last Post: 06-18-2015, 11:52 AM
  5. Replies: 3
    Last Post: 01-15-2012, 02:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums