Hi,
I am using access 2007. I have a front end form in access that runs a query to give me a list of information when the form opens. I can input into the form and its supposed to save my input on closing the form. My problem is that a secondary table exists with a link field to the main table. If the records exist on the secondary table then the imputed data will be saved. But I have a situation that the secondary table does not always have a record to match the main table and then the data won't save as it can't find a record to update (it throws an invalid key error).
How do I check when opening the form to see if all records have a matching record on the second table - and if not then insert them at this stage so that my input from the form works on closing.
I'm new to all this - VB6 programmer by trade, so any help is appreciated. Is there a way to do this using the VB add on for access or is there a way to construct an sql statement (I've a pretty basic knowledge of sql so be gentle please) to loop through all the records and insert as needed in the second table?
Thanks in advance
John B
I am using access 2007. I have a front end form in access that runs a query to give me a list of information when the form opens. I can input into the form and its supposed to save my input on closing the form. My problem is that a secondary table exists with a link field to the main table. If the records exist on the secondary table then the imputed data will be saved. But I have a situation that the secondary table does not always have a record to match the main table and then the data won't save as it can't find a record to update (it throws an invalid key error).
How do I check when opening the form to see if all records have a matching record on the second table - and if not then insert them at this stage so that my input from the form works on closing.
I'm new to all this - VB6 programmer by trade, so any help is appreciated. Is there a way to do this using the VB add on for access or is there a way to construct an sql statement (I've a pretty basic knowledge of sql so be gentle please) to loop through all the records and insert as needed in the second table?
Thanks in advance
John B