Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2013
    Posts
    1

    Unanswered: Visual Basic code help - multi field search

    I found the code below and tweaked it to work with my database to use an unbound text box to search the 'LeadNumber' field. What I've been unable to do is tweak it further (tried using 'OR' followed by code for additional field name) to search the "LeadNumber" and second field called "AgentLeadNumber".

    Any help will be greatly appreciated!

    Private Sub leadsearch_AfterUpdate()
    Dim rec As Recordset

    Set rec = Me.RecordsetClone
    rec.FindFirst "LeadNumber like '*" & leadsearch & "*'"

    If rec.NoMatch Then

    MsgBox "Invalid Lead Number"

    Else

    Me.Bookmark = rec.Bookmark
    leadsearch.SetFocus

    End If

    leadsearch = Null

    rec.Close

    End Sub

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Try:
    Code:
    rec.FindFirst "LeadNumber like '*" & leadsearch & "*' OR AgentLeadNumber Like '*" & leadsearch & "*'"
    Have a nice day!

Tags for this Thread

Posting Permissions

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