Results 1 to 2 of 2
  1. #1
    trigirl67 is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Jan 2012
    Posts
    3

    FINDFIRST Multiple criteria

    I am doing a record set clone with a FindFirst. Here is what I have

    rs.FindFirst "[Physician Group Name]=""" & Me!Combo148 & """

    and it works but I need to add another condition so now I have:

    rs.FindFirst "[Physician Group Name]=" & Me!Combo148 & " And " & _
    "[Request Date]=#" & Me!RequestDate & "#"

    and it DOES NOT work, but this one does with another criteria below does work:

    rs.FindFirst "[TIN]=" & Str(Nz(Me![Combo148], 0)) & " AND " & _
    "[Request Date] = #" & Me![RequestDate] & "#"

    I do not understand why it is not working for the physician group name!!!

    I am also doing an If statement:

    Dim rs As Object
    Set rs = Me.Recordset.Clone
    If [Searchbox] = "TIN" Then
    rs.FindFirst "[TIN]=" & Str(Nz(Me![Combo148], 0)) & " AND " & _
    "[Request Date] = #" & Me![RequestDate] & "#"



    ElseIf [Searchbox] = "Physician Group Name" Then
    rs.FindFirst "[Physician Group Name]=""" & Me![Combo148] & """"
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    End If
    End Sub

    The first part works with the TIN if the ELSEIF is not there and the second parts works but I need them to work together and the second part to have the date criteria as well.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,943
    You use Combo148 for both so I presume it is a multi-column with columns for physician ID and name? If the bound field is the ID, then the value of the combobox is the ID, not the name and it is the ID that is the criteria in both. Is TIN an autonumber field? If so, the Str function serves no purpose.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Using FindFirst code
    By saltydawg617 in forum Access
    Replies: 2
    Last Post: 07-29-2011, 05:21 PM
  2. FindFirst with multiple fields in criteria
    By compooper in forum Programming
    Replies: 5
    Last Post: 07-22-2011, 10:29 AM
  3. Replies: 1
    Last Post: 07-13-2011, 11:00 AM
  4. using FindFirst with a Date Criteria (syntax error)
    By ajetrumpet in forum Programming
    Replies: 2
    Last Post: 09-10-2010, 11:01 PM
  5. Recordset Findfirst Problem
    By ColPat in forum Programming
    Replies: 6
    Last Post: 07-22-2010, 04:34 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