Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228

    show all records when criteria for DATE field is null.

    I've been doing a bit of reading and I'm yet to find an answer. If I want to see all results for a blank text string its easy.



    Code:
    Like "*" & [Forms]![forname]![Comboname] & "*" Or Is Null
    something along those lines will do the trick. However. Doing this with dates. I cant see anything useful. This is what I'm using:

    Code:
    <[Forms]![Expirey_dates_all]![Date_Filter]
    I'm assuming its possible and if it is, its probably easy. Anyone done this before?

    This is the last part of this form and ill be happy to say I'm never opening it again. Its been one of the more difficult ones haha.

  2. #2
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Date between function andy? Use two dates that must catch all data?

  3. #3
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    If there is no date entered then I want it to show all. Otherwise show values before the date.

    I have a workaround. On an update event I change the year to 2099 in the textbox. But I don't think its obvious or makes much sense to the user.

  4. #4
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    But if you set that in vba they'd never know?

  5. #5
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    I'm sure this could work. But I cant think how to implement it. at the moment the form query references the textbox.

    Are you suggesting to use the SQL in VBA then use an if statement to see if the textbox contains the value?

  6. #6
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Well what about just making the text invisible when they press the button If the txt box value is null?

  7. #7
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    or, if the textbox =2099.

    Could work. Ill have a go tomorrow. Thanks for the input.

  8. #8
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    How about this:

    Code:
    Private Sub cmdSearch_Click()
    Dim myfilter As String
    myfilter = "Year([trandate]) > " & CInt(Nz([Txtsearch], 1900))
    Me.Filter = myfilter
    Me.FilterOn = True
    End Sub
    or similar

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

Similar Threads

  1. Replies: 4
    Last Post: 08-25-2016, 04:19 PM
  2. Replies: 7
    Last Post: 07-17-2014, 12:42 PM
  3. Replies: 5
    Last Post: 10-12-2012, 11:00 AM
  4. Replies: 1
    Last Post: 08-31-2012, 01:56 PM
  5. Do not show null records
    By brobb56 in forum Forms
    Replies: 1
    Last Post: 09-23-2011, 02:29 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