search

Discussion in 'Microsoft Access Forms' started by jason, Dec 17, 2003.

  1. jason

    jason Guest

    hi everyone, ran into a little problem hopefully someone
    can help me with.
    I have a search form that I enter in any string of text
    and it will search a field in one of my tables for the
    string of text. This is how it is coded.

    stLinkCriteria = "[User Name]like" & "'*" & Me![Text0]
    & "*'"

    as you can see [User Name] is the field it is searching in
    a table i have.
    I was wondering if there is a way for me to manipulate
    this code so that instead of just searching the [User
    Name] field i can make it search the other two fields in
    the table as well? Im not an expert or anything in coding
    but trying to learn as i go.
     
    jason, Dec 17, 2003
    #1
    1. Advertisements

  2. jason

    Allen Browne Guest

    stLinkCriteria = "([User Name] Like ""*" & Me.Text0 & _
    "*"") OR ([AnotherField] Like ""*" & Me.Text0 & _
    "*"") OR ([MyThirdField] Like ""*" & Me.Text0 & "*"")"

    --
    Allen Browne - Microsoft MVP. Perth, Western Australia.
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "jason" <> wrote in message
    news:092d01c3c4ab$a8398720$...
    > hi everyone, ran into a little problem hopefully someone
    > can help me with.
    > I have a search form that I enter in any string of text
    > and it will search a field in one of my tables for the
    > string of text. This is how it is coded.
    >
    > stLinkCriteria = "[User Name]like" & "'*" & Me![Text0]
    > & "*'"
    >
    > as you can see [User Name] is the field it is searching in
    > a table i have.
    > I was wondering if there is a way for me to manipulate
    > this code so that instead of just searching the [User
    > Name] field i can make it search the other two fields in
    > the table as well? Im not an expert or anything in coding
    > but trying to learn as i go.
    >
     
    Allen Browne, Dec 17, 2003
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jurassic
    Replies:
    1
    Views:
    152
  2. Guest

    Search Form - Search whole database

    Guest, Nov 7, 2006, in forum: Microsoft Access Forms
    Replies:
    0
    Views:
    292
    Guest
    Nov 7, 2006
  3. Guest
    Replies:
    10
    Views:
    436
    Carl Rapson
    Mar 22, 2007
  4. Song Su
    Replies:
    1
    Views:
    199
    John W. Vinson
    Jul 26, 2007
  5. anthony

    Search for record that requires two search terms

    anthony, Mar 11, 2008, in forum: Microsoft Access Forms
    Replies:
    3
    Views:
    410
    ruralguy via AccessMonster.com
    Mar 11, 2008
Loading...

Share This Page