Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003

    Unanswered: Two Column Lookup

    I have a combo box that is populated with a list of Employers in Column(0) and their adresses in Column(1). I can get matches using only a single column, but not both... I get a 'Type Mismatch' error.

    Private Sub Combo13_Change()
    On Error GoTo Err_Command13_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Company Main"

    stLinkCriteria = "[Employer Name]=" & "'" & Me![Combo13].Column(0) & "'" And "[Employer Address]=" & "'" & Me![Combo13].Column(1) & "'"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

    Exit Sub

    MsgBox Err.Description
    Resume Exit_Command13_Click
    End Sub

    Thanks in advance

  2. #2
    Join Date
    Mar 2003
    The Bottom of The Barrel
    Provided Answers: 1

    Re: Two Column Lookup

    Which line is giving you your error?

    I did notice you seem to have an extra set of quotes in there, that may be the problem.

    stLinkCriteria = "[Employer Name]='" & Me![Combo13].Column(0) & "' And [Employer Address]='" & Me![Combo13].Column(1) & "'"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

  3. #3
    Join Date
    Nov 2003
    It is the StLinkCriteria line that is stopping this.

    I tried thte line you posted, but the second half of the expression is not recognized. (i.e. the And doesn't turn blue)

    I have fumbled with this for a while. When I think I get everything just right, i get a Type Mismatch error.

    Thanks for your 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