Hello,
I am not sure if this is possible without many lines of relatively redundant if/else statements, but in my quest to be an efficient developer, I ask the masses.
I have a subform that I have set to open (via button) and view the currently selected record based on a separate subform. This form will be used for editing the record, so I can lock down the previous form to prevent accidental changes to data. On the subform for editing the data, I have a button to save the record, which I am going to code to run an UPDATE to the table.
Is there an easy way to compare the value on the form fields with the value of its corresponding column in the table, and return either a boolean or integer, then use that value to UPDATE only the fields where the data has changed? I want keep this as streamlined and dynamic as possible, using as few lines of code as I can.
There are about 20 fields that could possibly be changed, so you can probably see my hesitation to write an individual statement for each one.
I am currently exploring the use of some creative FOR statements in VBA to pass values through variables to the SQL statement, but I figured it wouldnt hurt to ask here whilst I grind away, in case anyone had any ideas off the top of their head that I had not come up with.
I am not a very experienced developer, so pardon me if I have missed something that should be common knowledge.
Thank you in advance for your help.