简体   繁体   中英

MS ACCESS Update Table using Subform

I am creating a form to update my database. I would like the user to select two options to filter the results: Month and State Then I would like to populate a subform (in datasheet view) where the user can update the other corresponding columns (amount due, etc) Then I would like a button that uses the imputed data and updates the main database.

I created a query to filter the results based on the 2 combo boxes. When it is populated onto the subform it will not allow editing.

How do I begin to solve this problem?

*I've tried creating a temporary table using the query results, but I cannot get the temp table to populate into the subform so that I can just write an update query to move the results from the temp table to the main database.

Thank you so much!

Your query is probably not an updateable query so it disallows editing.

To use an updateable query or temp table in your subform, you need to use VBA to handle the dynamic process:

  1. Create temp table or run the updateable query from form's user-defined filter options.
  2. Bound the temp table to the subform's recordsource using Recordsource (example: Forms!MainForm!Subform.Form.Recordsource = "[TEMP TABLE]").
  3. Requery the subform to refresh it as it will not show immediately (example: Forms!MainForm!Subform.Requery).
  4. If using temp table, run your update action query to migrate temp data to actual database table. An updateable query would already connect to your actual table so will not need an update action query.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM