weightinwildcat
Programmer
I am working on a function that will cause a email messages to be sent when payment is received for an order. There can be more than one line item for each order, so I have to use queries rather than get values from checkboxes or other objects on my order form. The four fields I need to reference are boolean, and my code gets totals on each of them. So a True value is actually less than 0. The fields represent the following:
Payment Required to Start Work
Payment Received to Start Work
Payment Required to Ship
Payment Received to Ship
If the first two boolean values are True (less than 0) and have an equal value, and Payment Required to Ship does not equal Payment Received to Ship, a message should be sent that a down payment has been received. If all the values are equal and less than 0, a message should be sent that payment has bee received for the whole order.
The problem I am running into is that, even after I enter a checkmark in a checkbox, the new value does not get piacked up by my query. So I get a 0 when I should get a number less than 0, and the criteria do not get met.
I have tried DoCmd.RunCommand acCmdSaveRecord and Me.Dirty = False in the Click subroutines and the AfterUpdate subroutines for the Payment Received to Start Work checkbox and the Payment Received to Ship checkbox. So far, no luck.
Here is the query:
Set rs3 = db.OpenRecordset("SELECT ORDERS.OrderNumber, REPRESENTATIVES.Initials, " & _
"Sum(Not IsNull([PayStartReqDate])) As PayStartReq, Sum(Not IsNull([PayShipReqDate])) AS PayShipReq," & _
"Sum(Not IsNull([PayStartRecvdDate])) As PayStartRecvd, Sum(Not IsNull([PayShipRecvdDate])) AS PayShipRecvd " & _
"FROM REPRESENTATIVES INNER JOIN (ORDERS LEFT JOIN Payments ON ORDERS.OrderID = Payments.OrderID) " & _
"ON REPRESENTATIVES.RepID = ORDERS.RepID " & _
"WHERE ORDERS.OrderNumber = " & OrderNumber & _
" GROUP BY ORDERS.OrderNumber, REPRESENTATIVES.Initials", dbReadOnly)
Any thoughts on what else I should look at?
Thank you in advance.
Payment Required to Start Work
Payment Received to Start Work
Payment Required to Ship
Payment Received to Ship
If the first two boolean values are True (less than 0) and have an equal value, and Payment Required to Ship does not equal Payment Received to Ship, a message should be sent that a down payment has been received. If all the values are equal and less than 0, a message should be sent that payment has bee received for the whole order.
The problem I am running into is that, even after I enter a checkmark in a checkbox, the new value does not get piacked up by my query. So I get a 0 when I should get a number less than 0, and the criteria do not get met.
I have tried DoCmd.RunCommand acCmdSaveRecord and Me.Dirty = False in the Click subroutines and the AfterUpdate subroutines for the Payment Received to Start Work checkbox and the Payment Received to Ship checkbox. So far, no luck.
Here is the query:
Set rs3 = db.OpenRecordset("SELECT ORDERS.OrderNumber, REPRESENTATIVES.Initials, " & _
"Sum(Not IsNull([PayStartReqDate])) As PayStartReq, Sum(Not IsNull([PayShipReqDate])) AS PayShipReq," & _
"Sum(Not IsNull([PayStartRecvdDate])) As PayStartRecvd, Sum(Not IsNull([PayShipRecvdDate])) AS PayShipRecvd " & _
"FROM REPRESENTATIVES INNER JOIN (ORDERS LEFT JOIN Payments ON ORDERS.OrderID = Payments.OrderID) " & _
"ON REPRESENTATIVES.RepID = ORDERS.RepID " & _
"WHERE ORDERS.OrderNumber = " & OrderNumber & _
" GROUP BY ORDERS.OrderNumber, REPRESENTATIVES.Initials", dbReadOnly)
Any thoughts on what else I should look at?
Thank you in advance.