First, I would create the query in Access and get it to perform the way that you want. Then instead of opening this recordset with a SQL statement, I would open it this way:
Dim strSQL as String
strSQL = "SELECT * FROM qryDeliveryQuery"
If you can get the query to perform the way you want, then you should be able to do the rest.
However, if you are running an Update Query on the DeliveryNumber field...
First, it won't work if the DeliveryNumber field is the PK or autonumber.
Second, what you need to do is an UPDATE query in Access, and then ALL of your code would look like this:
Type "Update Query" in the Help box in the upper right of your Access window.