Results 1 to 8 of 8
  1. #1
    Dutch1956 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    12

    StrCriteria

    I have a form with an optiongroup named frame32, and 4 dates named InvDate, InvDate1, DueDate and Duedate1. I am trying to open this form from an on click event on my switchboard with the following criteria:
    When Frame 32 is 1, Then Invdate = < Date() and DueDate = < Date() and
    When Frame 32 is 0, Then InvDate1 =<Date() and DueDate1=<Date().
    I am trying to filter the records that are expired. I tried every possible combination of strings but am just not able to find one that works, probably because I am still a novice. Any help is really appreciated.

    Thanks



    Bert.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Why don't you post your effort and we'll fix it? Hard to know exactly what you're trying to do without seeing the code.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Dutch1956 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    12
    This is what I tried:
    Dim strCriteria As String
    strCriteria = ""
    strCriteria = "[PrePostPay] =" & 1 & "and [duedate]='" <= Date() & "'" & "[PrePostPay] =" & 0 & "and [duedate1]='" <= Date() & "'"
    DoCmd.OpenForm "overdueinvoiceform", acNormal, , strCriteria

    Bert

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Would certainly help to see your full procedure attempt. Can only guess you need something like:
    If Me.Frame32 = 1 Then
    DoCmd.OpenForm "formname", , , "Invdate =< #" & Date() & "# And DueDate =< #" & Date() & "#"
    ElseIf Me.Frame32 = 0 Then
    DoCmd.OpenForm "formname", , , "InvDate1 =< #" & Date() & "# And DueDate1=< #" & Date() & "#"
    End If
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You don't actually need to concatenate. Try:

    strCriteria = "[PrePostPay] = 1 and [duedate]<= Date() AND [PrePostPay] = 0 and [duedate1]<= Date() "
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    Dutch1956 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    12
    Thank you for the responses to my initial query. I think I was trying to do something that was not as easy as I thought it was. I was trying to sort dates that were in the same record. Luckily I found the solution which might not have been a little controversial. I created two queries with their own criteria and put them together in a Union All Query. Thanks again for the help.

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Are you ready to use the Thread Tools at the top of the thread and mark this thread as Solved?

  8. #8
    Dutch1956 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    12
    Thanks for reminding me and again, thanks for your help.

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

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