I am fairly new to Access and am trying to create a database that stores client details, sets up appointments and keeps a record on stock, amongst other things. I have been searching Google to no avail to find an answer to the issue that I'm currently having so am posting another question here. Please help!
Basically, I have a form that contains most of the contact details for someone using the service, and inside that there is a subform containing the address. When a client wants to change their address, there is a button to add a new address. Now this button runs a macro which does three things; firstly, it opens a new form to add a new address, then it goes to a new record and then it sets the value for first name and last name as the name of the person for whom we want to change the address.
The new form that is now up is based on a query to only bring up the details for the client on the open form for all the client details. It is also a split form; so basically all the old addresses are listed in a table at the bottom and the top of the form is where I can enter a new address (so has all the address fields, the address status [primary or inactive] and their first and last name).
What I've then done is add a button that changes any old addresses to inactive and the new address entered to the primary address. All this works until I want to save the record and exit the form to go back to the original client details. The data is not saved and it has disappeared from addresses. I have tried putting into a macro a save record command, which didn't seem to do anything, and also tried coding it in with the code below:
Most of the things I've tried just close the form without saving the new address I've put in, but once the pop up withdow stating "The Command or Action 'SaveRecord' isn't available now" came up.Code:If Me.Dirty Then DoCmd.RunCommand acCmdSaveRecord End If
What have I done wrong/what can I do to fix this? I am really stumped and have spent a few hours trying to work it out so any help would be appreciated. Thank you in advance.