Results 1 to 6 of 6
  1. #1
    sams is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2010
    Location
    Mayrhofen, Tirol, Austria
    Posts
    12

    my search form won't work?

    i made a search form with 4 unboud search-boxes (company, first name, last name, city) and 2 buttons : clear fields and search contact

    i set the deffaultvalue for every search-box to ""

    then for the clear fields button i used:
    Private Sub clear_fields_Click()
    Me.company.Value = ""
    Me.fname.Value = ""
    Me.lname.Value = ""
    Me.city.Value = ""
    End Sub

    and for the searchcontact button i used:
    Private Sub search_Click()
    DoCmd.OpenQuery "contacts extended2", acViewNormal
    End Sub

    then in the contacts extended2 query i set the criteria for the compaby, fname, lname and city field to this:
    Like [forms]![Frmsearchcontacts].[*search-box name*] & "*"

    i dont know what i did do wrong?

    can anyone help me with this please?

    regards,



    Sam

  2. #2
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    Like [forms]![Frmsearchcontacts].[search-box name] & "*"
    or
    Like [forms]![Frmsearchcontacts].[search-box name] + "*"

  3. #3
    sams is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2010
    Location
    Mayrhofen, Tirol, Austria
    Posts
    12
    when i use:

    Like [forms]![Frmsearchcontacts].[searchbox-name] & "*"

    i have to enter a parametervalue

    when i use:

    Like [forms]![Frmsearchcontacts].[searchbox-name] + "*"

    the query returns empty?

    any other suggestions?

    Sam

  4. #4
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    the parameter value dialog box usually means you misspelled something. make sure your spelling and capitilization are correct.

  5. #5
    sams is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2010
    Location
    Mayrhofen, Tirol, Austria
    Posts
    12
    thanks for your post.

    i did that. i also changed the names of the search boxes to be sure.
    now the query works for one search, and on another search it returns empty??

    i'll add the db if you want to take a look.

    i would appreciate it.

    Sam

  6. #6
    sams is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2010
    Location
    Mayrhofen, Tirol, Austria
    Posts
    12
    the solution to the problem is:

    Like [forms]![Frmsearchcontacts].[*search-field name*] & "*" Or Is Null

    thanks for the help

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

Similar Threads

  1. Create combo search form in subform
    By grant.smalley in forum Forms
    Replies: 6
    Last Post: 02-19-2010, 04:37 AM
  2. Replies: 2
    Last Post: 11-04-2009, 09:45 PM
  3. Search form with a date range
    By mantro174 in forum Forms
    Replies: 1
    Last Post: 02-11-2009, 10:45 PM
  4. Refresh form search text box
    By oxicottin in forum Forms
    Replies: 2
    Last Post: 11-19-2007, 02:28 PM
  5. Search for record from a form
    By hcoakley in forum Forms
    Replies: 0
    Last Post: 11-26-2006, 11:23 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