none
vba get database extension RRS feed

  • Question

  • HI

    I have to get the extension of the database.

    I know if it is an accdr I have to use SysCmd(acSysCmdRuntime).

    But I have to know if the access extension is accde or accdb.

    Someone can help me?

    Thanks

    Marco Dell'Oca



    Friday, December 21, 2018 5:36 PM

Answers

  • Hi,

    Have you tried?

    Mid(CurrentDb.Name, InStrRev(CurrentDb.Name, ".")+1)

    • Marked as answer by Marco Dell'Oca Saturday, December 22, 2018 5:46 PM
    Friday, December 21, 2018 5:41 PM
  • But I have to know if the access extension is accde or accdb.

    Hi Marco,

    An alternative could be:

      extension = Split(CurrentDb.Name, ".")(UBound(Split(CurrentDb.Name, ".")))

    In this way it is also easy to find the part after the last separator (.), as in the example, but also the one but last part, or the second.

    Imb.

    • Marked as answer by Marco Dell'Oca Saturday, December 22, 2018 5:46 PM
    Friday, December 21, 2018 9:54 PM

All replies

  • Hi,

    Have you tried?

    Mid(CurrentDb.Name, InStrRev(CurrentDb.Name, ".")+1)

    • Marked as answer by Marco Dell'Oca Saturday, December 22, 2018 5:46 PM
    Friday, December 21, 2018 5:41 PM
  • But I have to know if the access extension is accde or accdb.

    Hi Marco,

    An alternative could be:

      extension = Split(CurrentDb.Name, ".")(UBound(Split(CurrentDb.Name, ".")))

    In this way it is also easy to find the part after the last separator (.), as in the example, but also the one but last part, or the second.

    Imb.

    • Marked as answer by Marco Dell'Oca Saturday, December 22, 2018 5:46 PM
    Friday, December 21, 2018 9:54 PM
  • Many Thanks to everybody.

    Marco Dell'Oca

    Saturday, December 22, 2018 5:46 PM
  • Many Thanks to everybody.

    Marco Dell'Oca

    Hi Marco,

    You're welcome. Imb and I were happy to assist. Good luck with your project.

    Wednesday, December 26, 2018 3:56 PM