Results 1 to 3 of 3
  1. #1
    Gregm66 is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2016
    Posts
    36

    Help with code for textbox search

    Hi all,



    I have a textbox that I want to search a field in a table for what ever Ingredient is typed into the textbox, then populate a combobox with all the recipe names that have that Ingredient in them.

    I am using the code below but it keeps giving me an error

    Any help on this would be appreciated.

    Code:
    Private Sub CmdSearch_Click()
        Me.txtSearch = DLookup("Table1", "rcpIngredients", "RcpName = CmbSearch")
    End Sub

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    Don't use Dlookup, use the textbox in a query, then open the query.
    Docmd.openquery "qsFind"

    the qry:
    select * from table where field like "*" & forms!frmFind!txtFind & "*"

  3. #3
    Gregm66 is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2016
    Posts
    36
    thanks for the reply ranman256,

    I will try that way and see how I go.

    thanks again

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 8
    Last Post: 11-20-2015, 10:08 AM
  2. Textbox Search
    By MCCDOM in forum Forms
    Replies: 12
    Last Post: 01-06-2015, 11:01 AM
  3. Replies: 3
    Last Post: 01-04-2015, 06:09 PM
  4. Replies: 4
    Last Post: 07-10-2014, 01:21 PM
  5. Instant Search with textbox in Form
    By MrBeardo in forum Queries
    Replies: 1
    Last Post: 03-28-2012, 02:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums