OK, understood. Wasn't thinking straight. I guess once the link has been established, I dont have to redefine it even though the otherdb file gets replaced on a daily basis.
Many thanks. Appreciate all the help.
Many thanks for this Paul. The following code works great to delete the link if one exists, establish the link again, export table to excel and then delete all records from the table.
Sub Macro3()
On Error GoTo Macro3_Err
If Len(CurrentDb.TableDefs("tblEvents").Connect) > 0 Then...
Hi
I have 2 databases, mymacros.mdb and otherdb.mdb
I am writing some vba code in mymacros.mdb to try and export a table from otherdb to excel. I do this becuase there is a new copy of otherdb created on a daily basis.
I have tried using docmd.output and docmd.transferspreadsheet to achieve...