Hi, I am using the expression generator in a text box in my Form. I added the text box in the Form from a field that I had previosuly created in my table. Everything works on the form (I get the calculation that I wanted, average depths), but when I go to my table the fields are blank, the data are not there but it is shown on the Form. Can anybody tell me how to make access save the data in the table? Thanks
expression generator in the form- data are not saved in corresponding table
Collapse
X
-
-
The expression generator makes a calculation for you. Once you start using something like an expression generator, the field is no longer bound to a specific field in your table.
What you can do if you need to store this kind of information, is to make a second field in your form, bind it directly to teh field in your table, and then set its Visible=False. Now in the beforeupdate event of your form, you can then make the code store the generate value in the hidden textbox.
This is the solution to your problem as described, but I would like to make sure we are solving the right problem. Therefore I ask, why do you need to store the calculated value, and why not just calculate it when needed?Code:Private Sub Form_BeforeUpdate(Cancel as integer) Me.BoundField=Me.CalculatedField end Sub
-
Hi, thanks for the answer. That didn't work. I'm new using access so I don't know much about it. I wanted to have the information generated by the expression generator on my tables for posterior analysis but I guess another option is to generate that information in queries and use those. And using those unbound fields on the forms only for visual purposesThe expression generator makes a calculation for you. Once you start using something like an expression generator, the field is no longer bound to a specific field in your table.
What you can do if you need to store this kind of information, is to make a second field in your form, bind it directly to teh field in your table, and then set its Visible=False. Now in the beforeupdate event of your form, you can then make the code store the generate value in the hidden textbox.
This is the solution to your problem as described, but I would like to make sure we are solving the right problem. Therefore I ask, why do you need to store the calculated value, and why not just calculate it when needed?Code:Private Sub Form_BeforeUpdate(Cancel as integer) Me.BoundField=Me.CalculatedField end Sub
Comment
Comment