Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Mar 2002
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Finds no match (Access 2000 VBA)

    I would like to create an elseif when there is no match for the below stLinkCriteria, is there an easy statement, I tried

    ElseIf Forms![frmMain]![txtSearchPartNumber] <> [Invertory.PartNumber] Then

    Else
    stLinkCriteria = "[Invertory.PartNumber] Like ""*" & Forms![frmMain]![txtSearchPartNumber] & "*"""
    stDocName = "frmEnter"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    End If

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Finds no match (Access 2000 VBA)

    You probably need a DLookup or DCount, for example:

    ElseIf DCount("*", "Invertory", "PartNumber Like ""*" & Forms![frmMain]![txtSearchPartNumber] & "*""") = 0 Then
    ...
    Else
    ...
    End If

    (Shouldn't it be inventory instead of invertory? Or is it a Czech database?)

  3. #3
    2 Star Lounger
    Join Date
    Mar 2002
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Finds no match (Access 2000 VBA)

    Thanks for the code and spelling help

Posting Permissions

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