Results 1 to 2 of 2

Thread: Search!

  1. #1
    Join Date
    Feb 2004

    Unanswered: Search!

    Im trying to create a search facility - I posted something like this before but i just couldnt figure it out! Now i know im pretty close but just one thing i wonder if you could help me with -
    This is the code:
    Dim szLastName As String, szCrit As String

    'Retrieve the entered Search Criteria
    szLastName = Nz(Me!txtSurname, "")

    'Determine if the user entered criteria
    If Len(szLastName) = 1 Then
    MsgBox "You must first enter a Surname to search on."
    Cancel = True
    'Build Criteria
    szCrit = BuildCriteria(txtSurname, dbText, szLastName)

    'Apply the Filter to the form
    DoCmd.ApplyFilter , szCrit

    End If

    txtSurname.Value = ""

    When i F8 it, the szCrit is picking up the value of the surname that i wish to search for but when i F8 past the Filter its bringing up a message box with the Title bar saying "Enter Parameter Values" and the surname is being displayed on the message box with a text box below it - Neone have any idea why its asking me for Parameters?!

  2. #2
    Join Date
    Oct 2003
    What exactly is in your szCrit variable? What parameter value is indicated?

    The problem is your szCrit string contains something that is not on the form or is not in the form's query. Here is a filter from my form: ((MasterFrmQy.StatusCd="I"))

    Run you form.
    Click in the field by which you want to filter.
    Right click and choose Filter By Selection.
    Design your form
    In the property window, copy out the text in the Filter property.
    Make your BuildCriteria function's return value look the same.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts