Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Output button "type mismatch" 1

Status
Not open for further replies.

trustsun

Technical User
Feb 4, 2004
73
US
This was originally posted via thread 701-1183479. I should have started it here, sorry.

Getting the infamous "type mismatch” as the error.” PHV and dhookum tried but to avail. It happens on the last filter combo box because it's a number value. What should I do?


Private Sub cmdfilsave_Click()
On Error GoTo MyErr
strFilter = "[TYPE]=" & Nz("'" + Me![combo1] + "'", "[TYPE]") & " AND "
strFilter = strFilter & "[ALC]=" & Nz("'" + Me![combo2] + "'", "[ALC]") & " AND "
strFilter = strFilter & "[DVID]=" & Nz("'" + Me![comb03] + "'", "[DVID]") & "AND "
strFilter = strFilter & "[NUBR]=" & Nz("'" + Me![combo4] + "'", "[NUBR]")
DoCmd.OutputTo acReport, "FilerepotsSKU"
MyExit:
Exit Sub
MyErr:
If Err.Number <> 2501 Then
MsgBox Err.Description
End If
Resume MyExit
End Sub
 
You only use delimiters when setting criteria on text fields (single quotes) and date fields (hash (#)).

So - remove those delimiters on the last criterion - and - add the missing space in front of the last and.

Also, the concatenation operator in VB(A) is usually the ampersand (&) not the pluss sign (unless you're doing some "fancy Null stuff")

[tt]strFilter = strFilter & "[NUBR]=" & Nz(Me![combo4], "[NUBR]")[/tt]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top