T. McConnell
Registered User.
- Local time
- Today, 06:19
- Joined
- Jun 21, 2019
- Messages
- 63
Greetings all,
I have a question maybe could get some assistance on. I have a subform that will display parts available based on specific vehicle information (Year/Make/Model) this all works fine. What I am trying to do is when lets say I add more than one part to the subform but then realize I only need one. I added a remove button which when clicked will uncheck it from being a used part, remove the row from the list, and then run a query to remove the line from my Order Details. What is happening is if there is more than one and I click the remove button it removes all from the subform and instead of having both show back up in my list after a requery of the form, it only shows the oldest ID part available. I have attached pictures of the form before removing it, and what it looks like afterwards.
List picture is what is showing available to add.
List1 picture is when both added to the form.
List2 picture shows what is showing available after hitting the remove button and both clear from the subform. This also shows where the oldest ID is available. and the newest is no longer shown.
The codes below are what is being used.
Remove Button Code:
This is the Query Code to remove the Inventory (In SQL view):
I am just trying to figure out how to remove only one if needed, each row/record is tied to an OtherProductID, so if I can figure out how to code the remove button to just remove that row by the ID would be helpful.
Thanks for any and all help from the community.
I have a question maybe could get some assistance on. I have a subform that will display parts available based on specific vehicle information (Year/Make/Model) this all works fine. What I am trying to do is when lets say I add more than one part to the subform but then realize I only need one. I added a remove button which when clicked will uncheck it from being a used part, remove the row from the list, and then run a query to remove the line from my Order Details. What is happening is if there is more than one and I click the remove button it removes all from the subform and instead of having both show back up in my list after a requery of the form, it only shows the oldest ID part available. I have attached pictures of the form before removing it, and what it looks like afterwards.
List picture is what is showing available to add.
List1 picture is when both added to the form.
List2 picture shows what is showing available after hitting the remove button and both clear from the subform. This also shows where the oldest ID is available. and the newest is no longer shown.
The codes below are what is being used.
Remove Button Code:
Code:
Private Sub btnRemove_Click()
Me.UsePart.Value = False 'This unchecks the used part checkbox
Me.Requery 'This will requery my form to show the parts available based off if used part is checked or not.
DoCmd.OpenQuery "QryRemoveOtherInv" 'This query will remove the 0 quantity of my Order Details table (for reporting purposes mostly)
End Sub
This is the Query Code to remove the Inventory (In SQL view):
Code:
DELETE OtherOrderDetails.OtherOrderNumber, OtherOrderDetails.OtherProductID, OtherOrderDetails.Quantity, OtherOrderDetails.ProductCost
FROM OtherOrderDetails;
I am just trying to figure out how to remove only one if needed, each row/record is tied to an OtherProductID, so if I can figure out how to code the remove button to just remove that row by the ID would be helpful.
Thanks for any and all help from the community.