Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2006
    Posts
    72

    Unanswered: Visual basic referrences

    I'd like to know what the best way to deal with references is.

    On different computers, files that are referred to, are in different locations. For example if one computer has Office 2002, the files would be in an Office10 directory and if another computer has Office 2003, the files will be in an Office 11 directory. It doesn't end there either, sometimes two computers with the same version of office will have their directories in different places.

    If you develop an interface on one computer, how can you make it work on all computers that it is distributed to?

    One solution that is obvious to me is to move all the files that are referenced into the same directory as the interface is, refer to them there instead and make it part of the installation to put them in that directory.

    My problem with this however is that the reference window in Access VBA itself is not wide enough to show me the full location for some of the files that it refers to. So I can't find all the VBA files I'm referring to and if I can't find them, I can't copy them to another location.

  2. #2
    Join Date
    Apr 2004
    Location
    Sydney Australia
    Posts
    369
    Perhaps this might be something that could be used. The link is from AllenBrowne's site and for File Listing

    Microsoft Access tips: List files recursively

    Note a few lines down the link to Listing Files to Table and also for the Call, the one on sub directories. I just tested it on Program Files and it worker.

    I have quite a few things built around this function but not for what you are doing but it might work.

    1) It will list all the files into a table with the full path. With use of of Left(), Right() or whatever you can extract what you want.

    2) I guess you could then have a query etc to bring up any specifc files such as MSACCESS.EXE or WINWORD.EXE etc. and that in turn on the same record would be showing the full path

    3) Perhaps you could have a delete query that deletes all records except the one that has the file/path you want and maybe use that file/path dynamically for what you are wanting to do. You certainly run the function each time something was required because it is very fast.

    As a side note I use the fucntion to get all file names into an Access table so that I can dynamically open such things as Word etc. so even if it does not help with your current problem you might find it of use for other things.

  3. #3
    Join Date
    Apr 2004
    Location
    Sydney Australia
    Posts
    369
    PS,

    I have attached a Word doc where I copied two records after Program Files has been run. As you will see I have Office11 and 12 and 12 is due to Runtime A2007
    Attached Files Attached Files

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    .MDB ???
    - no issue, this code-bank post shows add ref from GUID
    way WAY WAY faster than messing with file searches and adding ref from file

    don't know the GUID you need?
    run something like this on a working (??? your) machine
    Code:
    DELETED see post #5
    there are a couple of other approaches from other folk in the code-bank sticky.

    check for broken references and auto-heal?- this code-bank post includes example for DAO reference, but a similar principle could be applied to most references ...within certain limits of course: if Access can't run at all, it can't fix its references.

    .MDE
    - you are dead: can't edit references.

    izy
    Last edited by izyrider; 02-02-09 at 15:09.
    currently using SS 2008R2

  5. #5
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    ummmm
    sorry - wrong code, that was the file-getter.
    here's the GUID-getter:
    Code:
    Private Sub butDump_Click()
        Dim aref As Reference
        For Each aref In Application.References
            Debug.Print aref.Name & " " & aref.Major & "." & aref.Minor, "Broken: " & aref.IsBroken, aref.Guid
            Debug.Print , aref.FullPath
        Next
    End Sub
    izy
    currently using SS 2008R2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •