In Access 2010 I need to copy data from physical address fields in a table to mailing address fields in the same table if a yes/no checkbox is selected on a form. It seems like this would be very easy; however, I keep trying different things and nothing works.
When I click on the checkbox on the first record in the form, nothing gets updated. When I select the checkbox on the second record shown on the form, the first record in the table gets updated instead of the second record in the table. Also, I can’t get the updated records to show on the form once the fields get updated.
Right now I have a macro attached to the On Click of the checkbox and the macro is supposed to run a SQL query.
My SQL query is:
UPDATE tblVenues
SET ContactMailingAddress = ContactPhysicalAddress, ContactMailingSuite = ContactPhysicalSuite, ContactMailingCity = ContactPhysicalCity, ContactMailingState = ContactPhysicalState, ContactMailingZip = ContactPhysicalZip, ContactMailingCountry = ContactPhysicalCountry
WHERE ContactMailingAddressSame = true;
My macro is:
OpenQuery
Qry Name: qrySQLUpdateMailingAddresses
View Datasheet
Data Mode Edit
Stop Macro
Any help would be greatly appreciated.