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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple statement in WHERE clause

Status
Not open for further replies.

davyre

Programmer
Oct 3, 2012
197
AU
Code:
updateQry = "UPDATE QryOrderUnitID " _
         &  "SET QtyOrdered=" & updQtyOrdered & ", ETD=#" & updEtd & "#, UnitDeliveryDate=#" & updUdd & "#, Status=" & updStats _
         &  " WHERE OrderID=" & updOrderID & ", UnitID=" & updUnitID

I need to write WHERE clause where it matches up those two values, but I seems got a syntax error.
I prefer using AND expression, but it gave me error Type Mismatch. Anyone can help? Thanks
 
Type Mismatch suggests you probably have a string field that you are treating as numeric. If there are no text/string fields then this should work:
Code:
updateQry = "UPDATE QryOrderUnitID " _
         &  "SET QtyOrdered=" & updQtyOrdered & ", ETD=#" & updEtd _
         &  "#, UnitDeliveryDate=#" & updUdd & "#, Status=" & updStats _
         &  " WHERE OrderID=" & updOrderID & " AND UnitID=" & updUnitID

All of this assumes qryOrderUnitID is updateable.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top