Update a table based on subform selection?

fredalina

Registered User.
Local time
Today, 01:42
Joined
Jan 23, 2007
Messages
163
i have a table called Orders. The purpose of this database is to upload orders (from a spreadsheet) into the Orders table, the determine through a series of criteria if there are any stock numbers in the orders that need to be canceled. Based on those we want to keep, it will then export a file into a folder that will, through a batch process, upload those orders into the main system. The orders are currently uploaded manually, and there are no pre-checks to determine if we do in fact wish to take the order.

The first step is to identify stock numbers with a potential issue. The next step is to allow the user to look through only those "flagged" stock numbers, review the criteria causing the "flag", and determine if it's a valid order or not. The final step is to send the correct orders on their way to the export file.

At this time, the "Analyze" button on the order entry form brings up a new form that lists (via subform) only the exceptions. i would like to have a check box or something that the user can click to keep or discard the order. From there, there would need to be a delete query *based on that unbound check box in the subform* to delete those lines from the orders table. i've tried having the checkbox (or textbox, either way) be bound into a new Keep field in the Orders table, but it will not allow edits via the subform though it is set to allow edits. It appears that only having it be unbound will allow the edits, meaning i must find a way to use that value to update the value in the orders table...

Help?
 
Maybe drop a delete button your form and, in the OnClick event do something like:

CurrentDb.Execute "DELETE FROM Orders WHERE OrderNumber = " & txtOrderNumber
 
Well, I am guessing, as you said, this won't work on an bound subform. I never use bound forms. Maybe run a line of code that unbinds the form, perhaps

me.subform1.Form.RecordSource = ""
 
For future people who search for something similar and get to this thread, i got it to work.

First i unbound the form. Then i made an order exceptions table, with all of the fields from the analysis query plus a field called Keep (Yes/No field with default of No). The analysis query became an append query to add those flagged orders into the order exceptions table, and this table was used on the subform. The user can check or uncheck the "Keep" box, and then click a Send Order command button that combines those with a Keep value of -1 (checked) with those that were not exceptions (non-flagged orders) at the start. (This is also accomplished with 2 append queries).

Of course i have to delete out the records for the excepted orders as well, after all is done.

i despise append queries as a rule, but this works quite well.
 

Users who are viewing this thread

Back
Top Bottom