Results 1 to 3 of 3
  1. #1
    MvdBergh is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Location
    South Africa
    Posts
    3

    Question VBA Looking up dates "exception dates" in a table

    I have a simple schedule/planning database whereby I schedule staff for events. I have among others two forms with underlying tables as follow:


    1. I have a Main scheduling Table, "tblEventDates", with a field: PlanDate (Form frmEventDates)
    2. I have a separate Table, "tblExceptDates", with a field: ExecptDate (Form frmExceptDates) where exception dates such as holidays, conference dates, etc. are captured.


    What I need:
    The date entered in the field PlanDate needs to be checked against any exception dates entered in "tblExceptDates". A warning message then needs to be displayed to indicate the specific conflicting exception date.



    Any suggestions as to how to go about shall be highly valued.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870

  3. #3
    MvdBergh is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Location
    South Africa
    Posts
    3
    Very loosely, I have found a simple solution with DLookup at http://www.techonthenet.com/access/functions/domain/dlookup.php

    (To have a more sensible message displayed a second DLookup has been used to display the description of the exception date, ex. " - Christmas")

    Private Sub PlanDate_AfterUpdate()


    On Error GoTo 1:

    LDate = DLookup("ExceptDate", "tblExceptDate", "ExceptDate = PlanDate")
    LDescription = DLookup("Description", "tblExceptDate", "ExceptDate = PlanDate")

    MsgBox LDate & LDescription

    1: End Sub

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

Similar Threads

  1. Replies: 3
    Last Post: 02-16-2015, 01:04 PM
  2. Need blank option in a "between" two dates search
    By Gary Childress in forum Forms
    Replies: 2
    Last Post: 02-03-2015, 05:08 AM
  3. Replies: 3
    Last Post: 12-06-2014, 03:59 AM
  4. Replies: 1
    Last Post: 12-16-2013, 03:22 AM
  5. Replies: 2
    Last Post: 11-14-2012, 04:47 PM

Tags for this Thread

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