Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2003
    Posts
    3

    Unanswered: Help for VBA in MS Access.

    Hi, I'm having problems with the "Select" statment in MS Access. I'm trying to put code into a command button that will find an search for * LastNames ending with whatever the user puts in the Text box called txtFind. I have just one table in the database called tblInfo. Can someone help me please.

    Thanks.
    TJ

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    strSQL = "SELECT * FROM tblInfo WHERE LastNames Like ""*"
    strSQL = strSQL & Forms!theFormName.txtFind.value & "";"

    LastNames needs to be the field name in tblInfo that holds the last name
    theFormName needs to be the form name that holds textbox txtFind

    izy

  3. #3
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Is this what your looking for?

    "Select *
    From tblInfo
    Where LastNames Like '*" & txtInfo & "*'"

    That would search for the entered text anywhere in the field.

    Mark
    Inspiration Through Fermentation

  4. #4
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Sorry Izy. Didn't mean to step on your toes there!
    Inspiration Through Fermentation

  5. #5
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    RedNeckGeek: no toes hurt at all.
    ...and our proposals are slightly different: hope we are both right!

    izy

Posting Permissions

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