Results 1 to 1 of 1
  1. #1
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

    Multiple Criteria Date Query

    I am down to the point where I need to filter the data. I will try and explain as best as I can.My database is a Check Register db with scheduled transactions.


    I have everything in one table for this. Table name is tblEvent. The start of my criteria this; I think?? I can do this individually but NOT all together as one query and then display on one form, which is what I need.

    To be clear, I need to see what events are due for each day.If they are scheduled daily,weekly,monthly,quarterly or yearly. I am shooting for one query to accomplish this or at least get it all on one form. I have attached 2 tables with data in them for demo purposes.



    If ([EventStart]) <= Date() and ([Scheduled]) = False 'Have NOT Been Scheduled.

    1. Now, I need to see all the records that are due by day, i.e. "d" with a EventStart <= Date() and Scheduled = False and either a "o" or ( # ) of times of ReCurCount
    2. Next the same for month, i.e. "m" where EventDate >30

    EventStart First Occurence of event.
    RecurCount How many times the event will recur. 0 for one-off event.Leave blank if open-ended.
    PeriodFreq How may days/months/years between recurrences.
    PeriodTypeID Type of period for recurrence (day,month,year,...)
    Scheduled Yes/No Has Event Been Successfully Scheduled.


    PeriodTypeID = d day(s)
    = ww week(s)
    = m month(s)
    = yyyy year(s)


    EventID Primary Key
    EvenStart Date
    RecurCount Number
    PeriodFreq Number
    PeriodTypeID Text
    Scheduled Yes/No

    txtEndDate =IIf(([PeriodFreq] Is Null) Or ([PeriodTypeID] Is Null) Or ([RecurCount] Is Null),Null,DateAdd([PeriodTypeID],[RecurCount]*[PeriodFreq],[EventStart]))
    __________________________________________________ __________________________________________________ ___________________________________
    Here is what I have come up with, brain is fried, can't think!
    (txtentered) is the ScheduledDate (EventStart) is the StartDate (txtEndDate) is the StopDate

    (RecurCount) How many times the event will recur. 0 for one-off event. Leave blank if open-ended.
    (PeriodFreq) How many days/months/years between recurrences. Required.
    (PeriodTypeID) Type of period for recurrence (day, month, year, ...) Required.

    '---------------------------------------------------------------------------------------
    ' Procedure : Form_Current
    ' Author : Dave
    ' Date : 12/31/2012
    ' Purpose : Check For Required Criteria Before Allowing Event To Be Entered.
    '---------------------------------------------------------------------------------------
    '

    If ([txtentered]) <= Date() and ([RecurCount]) ="0" and ([PeriodFreq]) ="d" Then 'Open-Ended Event
    Me.Scheduled = True
    ElseIf ([txtentered]) <= Date() and ([PeriodFreq]) ="d" and ([RecurCount]) >0 Then 'Daily Reccurring Event
    Me.Scheduled = True
    End If

    If Date() > ([txtEndDate]) Then 'Event Time Has Passed and Event has Expired.
    Me.Scheduled = False
    Me.txtentered = Null
    End If


    This is just too complex for me, Thanks anyway.
    Last edited by burrina; 12-31-2012 at 06:36 PM. Reason: New Code I am trying.

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

Similar Threads

  1. Replies: 7
    Last Post: 01-02-2013, 11:23 PM
  2. Replies: 3
    Last Post: 08-21-2012, 03:05 PM
  3. Query using Date() criteria
    By Bruce in forum Queries
    Replies: 27
    Last Post: 01-30-2012, 01:15 PM
  4. Replies: 1
    Last Post: 07-13-2011, 11:00 AM
  5. Query Date Criteria
    By svanicek in forum Access
    Replies: 1
    Last Post: 07-09-2010, 11:13 AM

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