Question : Error on one line and not on the other

The first line of code works.  I have the second one giving me an error regarding the <.  I am using the same syntax for the PassedDate and the PassedDateEnd.  I don't see why it isn't working.

Thanks in advance!

Tanya
Code Snippet:
1:
2:
3:
4:
5:
This line works:
QueryString = "SELECT EquipmentMasterReadings.Equipment_Number, Max(EquipmentMasterReadings.Reading) AS CurrentMonthEnding, reading_date  FROM EquipmentMasterReadings GROUP BY EquipmentMasterReadings.Equipment_Number, reading_date HAVING reading_date  >= " & "'" & PassedDate & "'" & " AND reading_Date <= " & "'" & PassedDateEnd & "'" & " ORDER BY EquipmentMasterReadings.Equipment_Number, Max(EquipmentMasterReadings.Reading);"

Get Error on following line:  "Incorrect syntax near '<'."
        QueryString = "SELECT LubeTransactions.Equipment_Number, Sum(LubeTransactions.Quantity) AS SumOfQuantity, LubeTransactions.Lube_Type, Sum(IIf([Oil_Change]<>" & "'" & "Yes" & "'" & ",[Quantity],Null)) AS 40wt, Sum(IIf([Oil_Change]=" & "'" & "Yes" & "'" & ",[Quantity],Null)) AS oilchange FROM FuelConsumptionTemp WHERE Transaction_Date >= " & "'" & PassedDate & "'" & " AND Transaction_Date  <=  " & "'" & PassedDateEnd & "'" & "  GROUP BY LubeTransactions.Equipment_Number, LubeTransactions.Lube_Type HAVING LubeTransactions.Lube_Type = " & "'" & "Engine Oil 40WT" & "'" & " ORDER BY LubeTransactions.Equipment_Number;"

Answer : Error on one line and not on the other

Hi,

Please check the code, I have commented some of your lines.. please check it and let me know.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
<html>
<head>
    <style>
.redRow
{
   background-color:red;
}

.blueRow
{
   background-color:blue;
}

.greenRow
{
   background-color:yellow;
}

body {
        font: normal 11px auto "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
        color: #4f6b72;
        background: #E6EAE9;
}

a {
        color: #c75f3e;
}

mytable {
        width: 700px;
        padding: 0;
        margin: 0;
}

th {
        font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
        color: #4f6b72;
        border-right: 1px solid #C1DAD7;
        border-bottom: 1px solid #C1DAD7;
        border-top: 1px solid #C1DAD7;
        letter-spacing: 2px;
        text-transform: uppercase;
        text-align: left;
        padding: 6px 6px 6px 12px;
        background: #CAE8EA url(images/bg_header.jpg) no-repeat;
}

th.nobg {
        border-top: 0;
        border-left: 0;
        border-right: 1px solid #C1DAD7;
        background: none;
}

td {
        border-right: 1px solid #C1DAD7;
        border-bottom: 1px solid #C1DAD7;
        /*background: #fff;*/
        padding: 6px 6px 6px 12px;
        color: #4f6b72;
}


td.alt {
        /*background: #F5FAFA;*/
        color: #797268;
        font: bold 10px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
}

th.spec {
        border-left: 1px solid #C1DAD7;
        border-top: 0;
        background: #fff url(images/bullet1.gif) no-repeat;
        font: bold 10px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
}

th.specalt {
        border-left: 1px solid #C1DAD7;
        border-top: 0;
        background: #f5fafa url(images/bullet2.gif) no-repeat;
        font: bold 10px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
        color: #797268;
}

</style>
</head>
<body>
    <table>
        <tr class="redRow">
            <td class="alt">
                Model</td>
            <td class="alt">
                M9454LL/A</td>
            <td class="alt">
                M9455LL/A</td>
            <td class="alt">
                M9457LL/A</td>
        </tr>
        <tr class="blueRow">
            <td class="alt">
                Model</td>
            <td class="alt">
                M9454LL/A</td>
            <td class="alt">
                M9455LL/A</td>
            <td class="alt">
                M9457LL/A</td>
        </tr>
        <tr class="greenRow">
            <td class="alt">
                Model</td>
            <td class="alt">
                M9454LL/A</td>
            <td class="alt">
                M9455LL/A</td>
            <td class="alt">
                M9457LL/A</td>
        </tr>
    </table>
</body>
</html>
Random Solutions  
 
programming4us programming4us