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

    Using checkbok values in a query

    This is a "best practice" type question rather than a "help me".



    I am using this code as a filter on a checkbox:
    Code:
    Private Sub ChkNullDate_Click()
    If Me!ChkNullDate = True Then
    Me.Filter = ""
     Else
     
     Me.Filter = "IsNull(Date_Completed)"
     End If
    Me.FilterOn = True
    Me.Requery
    Me.Refresh
    End Sub
    The problem I face is; when I refresh the form as standard it will show all results regardless of the check box status. I can easily add that code to every refresh event but im wondering if I can put the checkbox status in the query?

    Any ideas appreciated.

    Thank you.

    Andrew.

    Edit: I see my title has a spelling mistake but im unable to correct.

    Update: in the criteria for "Date complete" I've tried using this code unsucessfully

    Code:
    IIf([Forms]![Order_list]![ChkNullDate]=-1,-1,0)
    this isnt exactly how I want it but anything working wouldbe a good start. Is there any reason this sint working?

  2. #2
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    Solved:
    https://stackoverflow.com/questions/...ed-on-checkbox

    June gave a simple solution.

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

Similar Threads

  1. Macro Loop values in Form ang get values to query
    By mauryc1990 in forum Programming
    Replies: 13
    Last Post: 12-22-2017, 08:30 AM
  2. Replies: 3
    Last Post: 10-30-2016, 05:50 AM
  3. Change Table Index Values Based on query Values
    By thuzkee02 in forum Import/Export Data
    Replies: 2
    Last Post: 11-24-2015, 11:45 PM
  4. Replies: 15
    Last Post: 10-18-2015, 04:05 PM
  5. Replies: 2
    Last Post: 11-12-2012, 03:52 AM

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