DoCmd.RunSQL not working anymore after db split

perlfan

Registered User.
Local time
Today, 12:44
Joined
May 26, 2009
Messages
192
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:
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
 
If you're not asking for error trapping you won't get one, try executing youre SQL by:
Code:
CurrentDb.Execute (strSQL), [B]dbFailOnError[/B]
This way if there is a error the code wil fail.
 
I just discovered that the auto increment values were missing. I had converted the table from MySQL and all primary keys were still there. Only the auto increment fields had been converted into number fields....:-/

Thank you, Frank
 

Users who are viewing this thread

Back
Top Bottom