Results 1 to 5 of 5
  1. #1
    radink is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2011
    Posts
    12

    Form queries. Multiple checkboxes.

    Hey all,

    Im a little stuck here.

    I have a form Im using to run a query. The form has multiple text fields and check boxes. Everything works fine If I just select (any)one of the check boxes. If I check more than one, I get no results. (which is because no records have them both selected). So if I change them or OR in the SQL code, I can get them to work, but then they stop working individually.

    My criteria for the checkbox is:
    IIf([forms]![frmsearch]![hist]=True,True,False)

    Changing "hist" to each appropriate field.



    The SQL is as follows:

    Code:
    SELECT [tblProject Info].[GALE JN], [tblProject Info].[Project Name], [tblProject Info].[Client Name], [tblProject Info].[Project Description], [tblProject Info].[Date Started], [tblProject Info].Type1, [tblProject Info].Type2, [tblProject Info].Type3, [tblProject Info].[Total Project Fee], [tblProject Info].Status, [tblProject Info].[Proj Mngr], [tblProject Info].Historical, [tblProject Info].Architects
    FROM [tblProject Info]
    WHERE ((([tblProject Info].[GALE JN]) Like "*" & [Forms]![frmSearch]![jobnum] & "*") AND (([tblProject Info].[Client Name]) Like "*" & [Forms]![frmSearch]![client] & "*") AND (([tblProject Info].Type1) Like "*" & [Forms]![frmSearch]![types] & "*") AND (([tblProject Info].Historical)=IIf([forms]![frmsearch]![hist]=True,True,0)) AND (([tblProject Info].Architects)=IIf([forms]![frmsearch]![arch]=True,True,0)))
    ORDER BY [tblProject Info].[GALE JN];
    It's like i need it to do AND and OR.

    Thanks for any help.

  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,726
    A couple of suggestions that you may find helpful.

    . don't use spaces in your table and object names. Find a naming convention and use it. You can Google Hungarian Naming, Leszynski naming convention etc. There is one here http://www.databasedev.co.uk/naming_conv.html

    .There is a video tutorial on a search form here. You may get some ideas from it.
    http://www.datapigtechnologies.com/f...earchform.html

    good luck

  3. #3
    radink is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2011
    Posts
    12
    Thanks again orange. The naming was done before I worked here. I always use a naming convention.

  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,726
    Good for you. Yes, sometimes we "inherit" some gems.

    Hope the Search tutorial is useful.

  5. #5
    radink is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2011
    Posts
    12
    That tutorial didn't have what i was looking for, but thanks.

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

Similar Threads

  1. Filter records based on multiple checkboxes
    By kbremner in forum Forms
    Replies: 2
    Last Post: 01-18-2011, 10:59 AM
  2. Filtering a report from multiple checkboxes
    By sabre1 in forum Reports
    Replies: 2
    Last Post: 01-17-2011, 03:37 PM
  3. coding to refer to multiple checkboxes and labels
    By tammiep in forum Programming
    Replies: 2
    Last Post: 11-29-2010, 01:43 AM
  4. select multiple checkboxes in access 2003?
    By GoneFusion in forum Forms
    Replies: 2
    Last Post: 09-20-2010, 01:44 PM
  5. Preventing multiple checkboxes
    By emerywang in forum Forms
    Replies: 2
    Last Post: 01-26-2010, 01:43 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