Results 1 to 4 of 4
  1. #1
    scorpion99 is offline Novice
    Windows 7 32bit Access 2002
    Join Date
    Nov 2013
    Posts
    27

    Search not working in my form


    Hi all,

    I have a problem in my database (see attached) where the search button doesn't work in the form, can somebody take a look of it and tell me what's wrong?
    Attached Files Attached Files

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    Your current query is a big AND statement.
    to make an OR statement, put each field criteria on a separate line


    Click image for larger version. 

Name:	Search OR.png 
Views:	14 
Size:	6.9 KB 
ID:	18621

  3. #3
    JeffChr is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    82
    If you take the phone number out of the query it works. You can't search for null.

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Actually, you can (kinda) search for null.... see http://access.mvps.org/access/queries/qry0001.htm

    There were several things wrong..... the "ID" field is an autonumber and shouldn't be visible to users, so I deleted the control on the form.


    ------------
    Here is some info on autonumbers:
    Autonumbers--
    What they are NOT and What They Are http://www.utteraccess.com/wiki/index.php/Autonumbers

    Microsoft Access Tables:
    Primary Key Tips and Techniques http://www.fmsinc.com/free/newtips/primarykey.asp

    Use Autonumbers properly
    http://access.mvps.org/access/general/gen0025.htm

    ------------


    You had the default value for the controls on the form set to "--". I removed the default values.
    I modified the query like the link above.
    I also changed the "Clear" code; set the controls to Null instead of an empty string.

    I prefer to build the filter on-the-fly: see http://www.allenbrowne.com/ser-62code.html


    You shouldn't use spaces, puncutation or special characters (exception is the underscore) in object names
    See http://access.mvps.org/access/tencommandments.htm

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

Similar Threads

  1. Replies: 3
    Last Post: 09-29-2014, 03:23 PM
  2. Search Form drop down fields not working
    By wnicole in forum Access
    Replies: 1
    Last Post: 09-19-2013, 07:43 AM
  3. Replies: 6
    Last Post: 07-19-2012, 11:43 AM
  4. Replies: 5
    Last Post: 04-06-2012, 11:06 AM
  5. Search Button in a Form not Working
    By spideynok in forum Forms
    Replies: 30
    Last Post: 03-29-2012, 01:10 AM

Tags for this Thread

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