none
Question RRS feed

  • Question

  • where do I put this Code:

    Function ImportTable(bpath As String) Dim db As Database Dim tdf As TableDef Set db = OpenDatabase(bpath) For Each tdf In db.TableDefs If Not (Left(tdf.Name, 4)) = "MSys" Then On Error Resume Next ' Try to delete existing table CurrentDb.TableDefs.Delete tdf.Name ' Then import from other database Access.DoCmd.TransferDatabase acImport, "Microsoft Access", bpath, acTable, tdf.Name, tdf.Name, False Else End If Next tdf Set db = Nothing End Function

    Saturday, July 16, 2016 4:49 AM

Answers

  • Hi Richocho,

    Go to the "Database Tools" Ribbon.

    in the Macro Group you will find option "Visual Basic". click on that option.

    or alternatively you can press Alt + F11 key to open VB Editor.

    now you will see your database name on the left panel.

    right click on that and you will find the option "Insert" then click on "Module".

    you can paste your code here.

    press "F5" key to run the code.

    Regards

    Deepak


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Saturday, July 16, 2016 7:15 AM
    Moderator