Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    radink is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2011
    Posts
    12

    Question QBF - Checkbox

    Hello everyone. new here.



    I've been trying to create a query by form. Doing simple things like finding text across different fields is no problem. What I also need to do, is check against check boxes. I can't seem to get the right criteria in the query to pull up only checked items. Everything I've found on the subject so far has been very cryptic and not helpful.

    Any help would be greatly appreciated.
    Thanks!

  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,716
    Please show us your query.

  3. #3
    radink is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2011
    Posts
    12
    Well for first and last name I have this (in the criteria):

    Like "*" & Forms!frmSearch.Fname & "*" Or Forms!frmSearch.Fname Is Null

    (Then similar for last name)

    I was trying the above for the checkbox but using =-1 but no luck.

    Not sure what else I should put in there.

  4. #4
    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,716
    Can you show us the sql for your query?
    Do you get an error message?

  5. #5
    radink is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2011
    Posts
    12
    Quote Originally Posted by orange View Post
    Can you show us the sql for your query?
    Do you get an error message?
    Code:
    SELECT tblEmployee.FirstName, tblEmployee.LastName, tblEmployee.Ext, tblEmployee.Photo
    FROM tblEmployee
    WHERE (((tblEmployee.FirstName) Like "*" & [Forms]![frmSearch].[Fname] & "*") AND ((tblEmployee.LastName) Like "*" & [Forms]![frmSearch].[Lname] & "*") AND ([Forms]![frmSearch].[Photobox]=-1)) OR (((tblEmployee.FirstName) Like "*" & [Forms]![frmSearch].[Fname] & "*") AND ((tblEmployee.LastName) Like "*" & [Forms]![frmSearch].[Lname] & "*"));
    No errors. Just doesn't do anything.

    Thanks

  6. #6
    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,716
    The check box your testing is a field in your table right?

    Have you tried a query along these lines --- just to get the check box thing working

    Select * from table where checkboxField = True (untested just trying to get that part working)

  7. #7
    radink is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2011
    Posts
    12
    tblEmployee.Photo is the checkbox field.

  8. #8
    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,716
    If you run a test query

    SELECT * from tblEmployee
    where
    tblEmployee.Photo =True

    Do you get the proper records selected?

  9. #9
    radink is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2011
    Posts
    12
    That works.

  10. #10
    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,716
    Was that the issue or is there more?
    When you do your search, can you work with a basic query then add the ore complex elements once you get the basic stuff working?

  11. #11
    radink is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2011
    Posts
    12
    I think so, this has helped me alot. Thanks orange!

  12. #12
    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,716
    You are welcome, glad to help.

  13. #13
    radink is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2011
    Posts
    12
    Well, this works great, but how do I implement this into the form im using to activate the search? I need the user to be able to check things off and have the query pick just those.

  14. #14
    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,716
    You need to know the field names involved. You'll have to set up a query that is based on the controls on the form.

    Your original post had the kind of things required.

    Can you describe the search you're going to do in plain English, then work on the VBA?

    There is a simple search video tutorial here.
    http://www.datapigtechnologies.com/f...earchform.html

  15. #15
    radink is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2011
    Posts
    12
    Sure thing.

    We have a database that we use to track jobs and clients.
    In the data, we have text fields and check boxes.

    So I want to make a form to drive a search that lets you enter text under for example, under the client name. Then we have check boxes that specify if they are government or schools, etc... So id like to have those on the search form also, so you could pick school and it would pick all of the schools, or maybe both, schools and government. I have the text boxes no problem. It's the check boxes that are giving me the headache.

    I watched the video and Im good on that part.
    Thanks.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Populate checkbox
    By Ashe in forum Forms
    Replies: 9
    Last Post: 01-03-2011, 09:43 AM
  2. Checkbox
    By Patience in forum Access
    Replies: 5
    Last Post: 06-22-2010, 05:37 AM
  3. Using a checkbox help
    By gbjc105 in forum Forms
    Replies: 1
    Last Post: 01-28-2010, 08:27 PM
  4. Checkbox
    By Rbtsmith in forum Access
    Replies: 2
    Last Post: 02-17-2009, 04:19 PM
  5. checkbox
    By Suresh in forum Forms
    Replies: 0
    Last Post: 12-19-2007, 01:30 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