Can you set a default value to another field value in the same table? How would you do that if so?
Can you set a default value to another field value in the same table? How would you do that if so?
Why not just try it and see? Should not take long?
You can in a form though?
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
Should clarify what you mean by "default value" as it has a specific meaning. If a user enters a value in a form control, the default is inconsequential (assuming you've set that property for the control). If they don't enter a value then update the control or the record, then the default is written to the field. If that happens and you want to change the value later, it is a simple update query.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
also clarify if you mean in a table, or dynamically in a form. Suggest provide some example data
The default value = value that will be filled in when starting a new, empty record. When starting a new, empty record, all fields are empty, so it has no sense to set the default to another empty field. What you can do is create a calculated field in the table, but then that field cannot be manually changed and will always depend on the value of the other field.
What you can do, as Welshman said, is add code to a form that will fill in the value of field1 in field2, when field2 is empty.
Last edited by NoellaG; 06-25-2022 at 04:09 AM. Reason: typo
Thank you all for your ideas. Before I posted this original thread, I simply added in the field name of the field I wanted the current field to default to but that didn't work. Thus, I wasn't sure if it was possible to set the default value of a field to a value in another field in the same table. NoellaG's point makes a lot of sense as there is no value in those other fields until such time a value is entered for the particular record. While I wasn't able to tie a default value of one field in a record to another field's value in the same record, I figured out another way to achieve my desired result. I am often restricted by my work from sharing portions of the actual dbase here so I really appreciate your help even without a visual of what I was doing. Thank you.
You can use a Calculated field type. This is intended for using other fields in the same record for calculations like adding sales tax for example, but you can use it simply to duplicate a value from another field. Just enter the field name as the Expression.