Sorry, not sure if this should be in the vba section, or the queries section, but I think it's more code-related so I've put it here.
I have a database that contains linked tables from multiple access databases. At certain points, code will trigger that is meant to copy a record from one table to another (using docmd.runsql "INSERT INTO..."), both of these tables are in two separate databases. Every so often, the query will fail and, although no errors are shown, the record isn't inserted into the destionation table. Unfortunately, the code then goes on to delete the record from the source table, so I haven't been able to test if it's something about the actual record that's the query to fail. I've now temporarily removed the delete query, so if it goes wrong again, I'll be able to try and insert the data myself and see what (if anything) goes wrong.
So, questions:
1. This is a multi-user database (everyone has their own local copy of the front end linked to multiple back end databases), is it likely that this is failing because of a record locking issue, or is it something else? (I've checked the destination table and there are no required fields, so even if there was some missing data that shouldn't be the cause).
2. Am I going about this the best way? In order to copy records from a table in one database to a table in another, should I link them in a central db and use runSQL from there, or would I be better off linking the tables within the databases and then executing the query in one of those (and would it be better to execute in the source or the destination)?
Sorry if this doesn't make much sense, I can usually fix most things, but as this doesn't always go wrong I need to try and work out what the specific set of circumstances are that make it go wrong and I was just hoping some of you might have some ideas.
Thanks.
I have a database that contains linked tables from multiple access databases. At certain points, code will trigger that is meant to copy a record from one table to another (using docmd.runsql "INSERT INTO..."), both of these tables are in two separate databases. Every so often, the query will fail and, although no errors are shown, the record isn't inserted into the destionation table. Unfortunately, the code then goes on to delete the record from the source table, so I haven't been able to test if it's something about the actual record that's the query to fail. I've now temporarily removed the delete query, so if it goes wrong again, I'll be able to try and insert the data myself and see what (if anything) goes wrong.
So, questions:
1. This is a multi-user database (everyone has their own local copy of the front end linked to multiple back end databases), is it likely that this is failing because of a record locking issue, or is it something else? (I've checked the destination table and there are no required fields, so even if there was some missing data that shouldn't be the cause).
2. Am I going about this the best way? In order to copy records from a table in one database to a table in another, should I link them in a central db and use runSQL from there, or would I be better off linking the tables within the databases and then executing the query in one of those (and would it be better to execute in the source or the destination)?
Sorry if this doesn't make much sense, I can usually fix most things, but as this doesn't always go wrong I need to try and work out what the specific set of circumstances are that make it go wrong and I was just hoping some of you might have some ideas.
Thanks.