Thanks for the reply.
In our Zoom training session, I showed you in Access I have a Setup Reports form. This is bound to the reports table. Same as in Five. I mentioned that I also have a Generate Reports form, which lets me choose which report from a list. I understand that I can add fields to this form and NOT base each field on a table column. Once the report is chosen, event code causes all fields to be populated with the data for that report. Unlike the Setup Reports form, the indifidual fields aren’t bound to the particular table fields. Instead, I populate them via an event which would run a function, which would populate each field manually from underlying data. I do this because I don’t want any changes to write back to the database. I want the values to be there so when I click the “Generate Report” button, it will then populate some temporary tables via SQL statements. Then the actual report will use those temporary tables to render the report.
This would require using some stack or context variables to populate the fields. I know this sounds very complicated. If instead, there was a way to disable the Save button on this new form, then I could make a more typical form where all fields are bound to the data table fields. I just don’t want to save any changes made on this new form.
Either way, when I click the “Generate Report” button on this new form, I need a function to run SQL statements to populate my fields in the temporary tables, then tell the report to render. Since the report is now based on a table, it should show the correct data. I would also need to disable certain fields on the form, and on the other “subform” pages, disable them if necessary. For example, the Reports table has a boolean field called “AskGroups”. If this field is false, then on the new “Generate Reports” form, that page for the study groups would be disabled.
I realize this is complicated, and I will be happy to arrange a call if needed. I think I know how to design the new “Generate Reports” form, I just don’t know how to write the code to populate the fields (that are not bound to table fields) when I select a report, or populate the temp tables when I click the “Generate” button. To clarify last sentence: I do know how to write the SQL statement to modify table data, just not how to refer to the current values on the form so I know how to construct the SQL statement with the proper values.
Please look at the Setup Reports form in the attached fdf file so you can see what I’m working with.
BrandeisConejo-20240509-0225431951347.fdf (4.5 MB)
To summarize:
1: Can I disable the save button on a form so I can use that form to make choices without saving back to the database?
2: If not, can I define fields not bound to the database table columns, and populate them in a function from variables from the underlying table?
3: How do I refer to the form fields in a JavaScript function which was called by a button on the form?
Thanks for reading this very long reply!