Hi there
Until now I had no problems with my DoCmd.RunSQL commands. Then I split my database to have an external db file. No I am linking the tables each time when I access my application. Now commands such as DoCmd.RunSQL "Insert... are not working anmore. There is no error, but nothing happens, no data gets inserted, selected, deleted etc.
Any ideas what I need to do??
Thank you for help!! Regards, Franks
Here is the code for linking the tables:
Until now I had no problems with my DoCmd.RunSQL commands. Then I split my database to have an external db file. No I am linking the tables each time when I access my application. Now commands such as DoCmd.RunSQL "Insert... are not working anmore. There is no error, but nothing happens, no data gets inserted, selected, deleted etc.
Any ideas what I need to do??
Thank you for help!! Regards, Franks
Here is the code for linking the tables:
Code:
Public Function LinkTable(strDatabaseSource As String, strTableSource As String, strTableDestination As String)
Dim dbSource As DAO.Database
Dim dbTarget As DAO.Database
Dim tdf As DAO.TableDef
On Error GoTo LinkTable_Err
Set dbSource = DBEngine.Workspaces(0).OpenDatabase(strDatabaseSource)
Set dbDestination = CurrentDb
Set tdf = dbDestination.CreateTableDef(strTableDestination)
tdf.connect = ";DATABASE=" & strDatabaseSource
tdf.SourceTableName = strTableSource
dbDestination.TableDefs.Append tdf
LinkTable = True
LinkTable_Exit:
dbSource.Close
Set dbSource = Nothing
Set dbDestination = Nothing
Set tdf = Nothing
Exit Function
LinkTable_Err:
LinkTable = False
Resume LinkTable_Exit
End Function