Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2005
    Posts
    144

    Red face Unanswered: List Box Search Feature

    Hi all,
    i am having trouble with going to the specified record on my form.

    I have this form that everyone logs in part numbers and serials which is working fine and now there is a need of a search button so i was browsing internet i found an example that i really like and when i try to implement it to my own dbase it doesnt seem to work and i get this line highlited as an error.

    DoCmd.OpenForm "1xFrm", , , _
    "[tbl1x.OrderID]=" & "'" & Me.lstSearch.Column(0) & "'"

    I have checked all fields to make sure they are the right fields but no luck here.
    Attached are the samle database (listbox search) and my database called try.
    Basically i would like to do what the sample database is doing, except open my own form.

    Any help would be greatly appriciated.
    Thanks
    Attached Files Attached Files

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    OrderID is numeric, so should not be surrounded by single quotes.
    Paul

  3. #3
    Join Date
    Jul 2005
    Posts
    144

    Compile error

    Quote Originally Posted by pbaldy
    OrderID is numeric, so should not be surrounded by single quotes.
    I hope i am correct when i say you there shouldnt be any quotes there surrounding orderid??
    or there should be double quotes instead??

    Either way i get a compile error

    Thanks

  4. #4
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    I said no single quotes:

    DoCmd.OpenForm "1xFrm", , , _
    "[OrderID]=" & Me.lstSearch.Column(0)
    Paul

  5. #5
    Join Date
    Jul 2005
    Posts
    144
    Thanks
    that worked like a charm i guess not only quotes i have to remove the table name and an extra & symbol as well not sure whey though??

    One last thing on my form i have setup a macro (onload) when form opens it goes to new record but with search form opens up and filters to a new record and i have to click back to see what i have filtered/searched. But when i remove that macro it works great. Any suggestion on how can i have my form goes to a new record and still be able to search it like that??

    THanks

  6. #6
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    I probably wouldn't have anything in the form itself, rather I'd control it when I opened it with the various arguments of DoCmd.OpenForm.
    Paul

Posting Permissions

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