Hello all,
I have a quick combobox question. I am having a brain freeze
right now and for the life of me can't figure this out.
I have a combobox with SupplierID info. When this box is changed to a different supplier, a subform changes to list the items for that Supplier.
Basically, what I want is that if a person changes that value (and there is a value already there) to popup a message saying that it will delete all the items in a subform. But if it is null, then let them change it without showing a message or deleting anything in the subform (which would be blank at this time anyway).
I am just stuck on which event to put it on and the exact coding.
In simple terms... if previous value is Null continue with value change, if not null, then popup a message saying "if you change this, you will delete all items below"
Here is the code that I have but not sure if it is right or which event to put it in.
Dim Response As Integer
If Me.cboSupplierID = vbNullString Then Exit Sub
Response = MsgBox("By selecting another Supplier, you will delete ALL previously made orders for this PO. Do you wish to continue?", vbYesNo, "Continue")
If Response = vbYes Then
DoCmd.OpenQuery "qryDeleteOrderDetails"
Me.Order_Details_subform.Requery
End If
Oh, and also, if the response is No, I want the combobox to go back to the original value.
Hope that makes sense...
Thanks
-Stoss
I have a quick combobox question. I am having a brain freeze

I have a combobox with SupplierID info. When this box is changed to a different supplier, a subform changes to list the items for that Supplier.
Basically, what I want is that if a person changes that value (and there is a value already there) to popup a message saying that it will delete all the items in a subform. But if it is null, then let them change it without showing a message or deleting anything in the subform (which would be blank at this time anyway).
I am just stuck on which event to put it on and the exact coding.
In simple terms... if previous value is Null continue with value change, if not null, then popup a message saying "if you change this, you will delete all items below"
Here is the code that I have but not sure if it is right or which event to put it in.
Dim Response As Integer
If Me.cboSupplierID = vbNullString Then Exit Sub
Response = MsgBox("By selecting another Supplier, you will delete ALL previously made orders for this PO. Do you wish to continue?", vbYesNo, "Continue")
If Response = vbYes Then
DoCmd.OpenQuery "qryDeleteOrderDetails"
Me.Order_Details_subform.Requery
End If
Oh, and also, if the response is No, I want the combobox to go back to the original value.
Hope that makes sense...
Thanks
-Stoss