[AccessD] Concatenated stLinkCritria produces Type mismatch error.

Helmut Kotsch Helmut.E.Kotsch at t-online.de
Tue Jan 27 17:11:13 CST 2004


Hi,
I am trying to open a form where 2 conditions have to be met.
When only one conditon (as shown in code below as sample#1 and sample#2) is
set than it works ok.

Sample#1  ==> OK

    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "VERDI-Kunden"
    stLinkCriteria = "[KundenName]=" & "'" & Me![KundenName] & "'"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Sample#2 ==> OK

    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "VERDI-Kunden"
    stLinkCriteria = "[VerbandNr]=" & Me![VerbandNr]
    DoCmd.OpenForm stDocName, , , stLinkCriteria

However when concatenating both conditions as shown in the following code I
get a "Type mismatch" error.

    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "VERDI-Kunden"
    stLinkCriteria = "[KundenName]=" & "'" & Me![KundenName] & "'" And
"[VerbandNr]=" & Me![VerbandNr]
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Hope someone can help before this one drives me grazy.


Helmut Kotsch



More information about the AccessD mailing list