H
hima
I get an error which says data type mismatch in criteria
expression....can anyone help me on th same...
Option Compare Database
Option Explicit
Private Sub CmdPerformCompare_Click()
Dim strValueList$
Dim rs As DAO.Recordset
Dim strSQL As String, strTemp As String
Dim j As Integer
Dim count As Integer
j = 0
If chkDTPanel.Value = -1 Then
strSQL = "SELECT DTPanel FROM TestTable INNER JOIN VehicleTable" & _
" ON TestTable.DoorTrimPanelID = VehicleTable.DoorTrimPanelID" & _
" WHERE (VehicleTable.OEM = """ & Me.cboOEM.Column(1) & """" & _
" AND VehicleTable.VehicleModel = """ & Me.CboVehicleModel.Column(1) &
"""" & _
" AND VehicleTable.ModelYear = """ & Me.cboModelYear.Column(1) & """)"
& _
" OR (VehicleTable.OEM = """ & Me.CboOEM2.Column(1) & """" & " AND
VehicleTable.VehicleModel = """ & Me.CboVehicleModel2.Column(1) & """"
& _
" AND VehicleTable.ModelYear = """ & Me.CboModelYear2.Column(1) & """)"
& " OR (VehicleTable.OEM = """ & Me.CboOEM3.Column(1) & """" & _
" AND VehicleTable.VehicleModel = """ & Me.CboVehicleModel3.Column(1) &
"""" & " AND VehicleTable.ModelYear = """ & _
Me.CboModelYear3.Column(1) & """)" & " OR (VehicleTable.OEM = """ &
Me.CboOEM4.Column(1) & """" & _
" AND VehicleTable.VehicleModel = """ & Me.CboVehicleModel4.Column(1) &
"""" & " AND VehicleTable.ModelYear = """ & _
Me.CboModelYear4.Column(1) & """)"
Debug.Print strSQL
Set rs = CurrentDb.OpenRecordset(strSQL)
If Not rs.EOF Then
rs.MoveFirst
Do Until rs.EOF
j = 0
count = rs.Fields.count - 1
For j = 0 To count
strTemp = strTemp & rs.Fields(j).Name & ": " &
rs.Fields(j) & " "
Next j
rs.MoveNext
Loop
Else
MsgBox "No Records"
End If
End If
txtResults.Value = strTemp
End Sub
expression....can anyone help me on th same...
Option Compare Database
Option Explicit
Private Sub CmdPerformCompare_Click()
Dim strValueList$
Dim rs As DAO.Recordset
Dim strSQL As String, strTemp As String
Dim j As Integer
Dim count As Integer
j = 0
If chkDTPanel.Value = -1 Then
strSQL = "SELECT DTPanel FROM TestTable INNER JOIN VehicleTable" & _
" ON TestTable.DoorTrimPanelID = VehicleTable.DoorTrimPanelID" & _
" WHERE (VehicleTable.OEM = """ & Me.cboOEM.Column(1) & """" & _
" AND VehicleTable.VehicleModel = """ & Me.CboVehicleModel.Column(1) &
"""" & _
" AND VehicleTable.ModelYear = """ & Me.cboModelYear.Column(1) & """)"
& _
" OR (VehicleTable.OEM = """ & Me.CboOEM2.Column(1) & """" & " AND
VehicleTable.VehicleModel = """ & Me.CboVehicleModel2.Column(1) & """"
& _
" AND VehicleTable.ModelYear = """ & Me.CboModelYear2.Column(1) & """)"
& " OR (VehicleTable.OEM = """ & Me.CboOEM3.Column(1) & """" & _
" AND VehicleTable.VehicleModel = """ & Me.CboVehicleModel3.Column(1) &
"""" & " AND VehicleTable.ModelYear = """ & _
Me.CboModelYear3.Column(1) & """)" & " OR (VehicleTable.OEM = """ &
Me.CboOEM4.Column(1) & """" & _
" AND VehicleTable.VehicleModel = """ & Me.CboVehicleModel4.Column(1) &
"""" & " AND VehicleTable.ModelYear = """ & _
Me.CboModelYear4.Column(1) & """)"
Debug.Print strSQL
Set rs = CurrentDb.OpenRecordset(strSQL)
If Not rs.EOF Then
rs.MoveFirst
Do Until rs.EOF
j = 0
count = rs.Fields.count - 1
For j = 0 To count
strTemp = strTemp & rs.Fields(j).Name & ": " &
rs.Fields(j) & " "
Next j
rs.MoveNext
Loop
Else
MsgBox "No Records"
End If
End If
txtResults.Value = strTemp
End Sub