Relative file references

前端 未结 3 1391
深忆病人
深忆病人 2021-01-12 17:02

In have built a couple of mda library files which I am then referencing from my main Access application (i.e. using Tools -> References from within the IDE).

Is ther

相关标签:
3条回答
  • 2021-01-12 17:50

    To get the file path for the access application

    CurrentProject.Path & "\"
    

    Then just add the other files into the same directory and get them by name. i.e.

    Dim filepath As String
    filepath = CurrentProject.Path & "\name_of_file.mda"
    
    0 讨论(0)
  • 2021-01-12 18:07

    Why not just place the three MDEs in the same folder on the target system? Access should find the MDE references just fine.

    Or are you using the add-in logic with the USysRegInfo table? You don't really need to do that with your own add-ins. Just with developer type add-ins such as Rick Fisher's Find and Replace.

    If this isn't working for you then tell us what error messages or symptoms.

    0 讨论(0)
  • 2021-01-12 18:09

    You can add VBA references through VBA itself.

    Dim sFilename As String
    sFilename = CurrentProject.Path & "\" & whatever.mda
    
    Application.References.AddFromFile sFilename
    

    Just put that in your AutoExec and that reference ought to be available for everything. Of course, you'll have to check if the reference already exists before adding it, otherwise you get an error. But that's just a matter of looping through Application.References.

    0 讨论(0)
提交回复
热议问题