Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2003
    Posts
    56

    Question Unanswered: Searching part of a field

    Hi all,

    I am trying to search a form for company data via another form. In form #2 the user can type in the company name or part of the company name and when they hit the command button the appropriate record is displayed in form #1.

    I am having problems setting up the criteria line in the code. Does anyone know the correct way to employ wildcards?!

    Any help would be appreciated.

    thanks,

    C.

  2. #2
    Join Date
    Jun 2003
    Location
    Belgium
    Posts
    133
    Could you post your code (the one that does not seem to work)?
    So that we understand better the problem and we'll probably find the solution faster.

  3. #3
    Join Date
    Jan 2003
    Posts
    56
    Yah, sorry!

    ++++++++++++++++++++++++++++
    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmCompany"

    stLinkCriteria = "[CompanyName]=" & "'" & "*" & Me![txtCriteria] & "*" & "'"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    +++++++++++++++++++++++++++++

    I know this is wrong!

  4. #4
    Join Date
    Jan 2003
    Posts
    56

    Cool

    Hi,

    I got it working, sorry to bother you all!

    I was using '=' instead of LIKE!

    Apologies

    C.

  5. #5
    Join Date
    Jun 2003
    Location
    Belgium
    Posts
    133
    Why don't you try this line instead :

    stLinkCriteria = "[CompanyName] LIKE '*" & Me![txtCriteria] & "*'"

Posting Permissions

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