locked
TransferDataBase Command With StructureOnly:=True not working RRS feed

  • Question

  • I have this code to create a backup of a linked table's structure, but when I run it, it copies the entire table over. Is this a bug or am I just being an idiot and missing something obvious. I'm running Access 2013 and the linked table is in sharepoint online. Can anyone help me fix my code?

    Code:

    Function CreateTable(sTableName As String, Original_Table As String, MessagePrompt As String)


    MsgBox "The " & MessagePrompt & " table did not exist. It will be created now with only the original table's structure"
    DoCmd.TransferDatabase acExport, "Microsoft Access", CurrentDb.Name, acTable, Original_Table, sTableName, StructureOnly:=True
    DoCmd.SelectObject acTable, sTableName, True
    RunCommand acCmdConvertLinkedTableToLocal
    'SafeGuard for now until i figure out structureonly problem
    DoCmd.RunSQL "DELETE * FROM " & sTableName & ";"

    End Function

    This is my first time programming with vba.

    Thanks in Advance

    Friday, July 31, 2015 8:13 PM