Results 1 to 2 of 2
  1. #1
    josejuancruz is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Dec 2010
    Posts
    1

    search button on Form

    I want to create a user form where the user will enter an order number, click on a custom search button and display the results: Order number, Serial Number, Site ID part of my query.
    I have the query, which contains the Forms![mainForm]![OrderNumber] which point to the unbound field for order number input. I have created a command button and in there I have on click [event procedure] and
    For the VB code
    on the cmdfilter
    Private Sub cmdfilter_click()
    Dim strwhere as string
    Dim ingleg as long
    If not Is null (me txtfilterOrderNumber) then
    strWhere = strWhere & "([OrderNumber]) like ""*" & me.txtfilterOrderNumber & "*"") and "
    End if


    End Sub

    I want to populate on the bottom 3 fields Order number, Serial Number and Site ID already pointing to the query on the control source

    when i enter an order number and click find it nothing happens. If i navigate through the next button on the bottom i see information feeding to the 3 fields, but when i enter an order number nothing happens. what I am missing? Please help.

  2. #2
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You had several syntax errors. Try this:

    Code:
    Private Sub cmdfilter_click()
       Dim strFilter As String
    
       If Not IsNull(Me.txtfilterOrderNumber) Then
          strFilter = "[OrderNumber] like ""*" & Me.txtfilterOrderNumber & "*"""
          '     Debug.Print strFilter
          Me.Filter = strFilter
          Me.FilterOn = True
       End If
    End Sub

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

Similar Threads

  1. Replies: 3
    Last Post: 08-10-2010, 02:12 PM
  2. Search Form VBA
    By rcdugge in forum Programming
    Replies: 2
    Last Post: 07-20-2010, 02:57 PM
  3. Replies: 3
    Last Post: 01-14-2010, 08:32 AM
  4. program find button to search whole table
    By sammer021486 in forum Programming
    Replies: 2
    Last Post: 10-01-2009, 06:36 AM
  5. Search and Clear button
    By polk383 in forum Programming
    Replies: 1
    Last Post: 08-30-2006, 08:51 AM

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