Hollis, Virginia
hollisvj at pgdp.usec.com
Mon Nov 30 14:26:51 CST 2009
I run an update query when a report closes that changes the Order Status (OrderItem - Yes/No) of an item to False. I use the below code to run an update query that changes OrderItem from True to False. The problem I run into is when the Order Status of an item is marked False (no items marked as needing ordered) I get an error when the report opens "You entered an expression that has no value." I also have a NoData that closes the report if there aren't any items that need ordered. I would like it to check if the OrderItem = True, if it does, then open the report. When the user closes the report, it runs the update query to change OrderItem = False. If OrderItem = False, then do not open the report, just give a NoData message. Private Sub Report_Close() If Me.OrderItem = True Then DoCmd.SetWarnings False vbresponse = MsgBox("You are about to change the Order Status", vbYesNo, "Update Data?") If vbresponse = vbYes Then DoCmd.OpenQuery "qry_UpdateOrder" End If DoCmd.SetWarnings True End If End Sub