Results 1 to 4 of 4
  1. #1
    ysrini is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    10

    parametrize file path

    Hi, i have two folders, one for source and the other for reports


    I have 20 linked tables to the xls files in the source folder
    and 50 reports that write to the report folder

    The paths are now all hard coded
    How can i parametrize the linked tables path?
    Also want to parametrize the path of the report output path, so that in future if the source and report folder locations are changed then i should be able to update the access db by just changing the path parameter

    Thanks
    -srinivas y.

  2. #2
    SoftwareMatters is offline Access VBA Developers
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Dorset
    Posts
    274
    The best way to do this is set a database property. Go to File/Database Properties to open the database properties window. Click on the custom tab and you can enter a name, type and value for your global parameters. Then you just need to call the parameter in code - something like this:

    Dim db As Database, Doc As Document
    Set db = CurrentDb
    Set Doc = db.Containers("Databases")!userdefined
    YourParameter = Doc.Properties!YourParameter

  3. #3
    ysrini is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    10
    Thanks 'SoftwareMatters', appreciate your response

    Under Macros Object, i have Action as
    "Output To"
    Output File = C:\a\b\c\d\e\f\g\rpt1.snp

    If i declare a parameter 'par1' with value "C:\a\b\c\d\e\f\g\" in the db properties, i want to set the above output path something like:
    Output File = #par1#\rpt1.snp

    I understand your code. Is there a more straight forward implementation of parameters without really having to write code behind
    Thanks

  4. #4
    SoftwareMatters is offline Access VBA Developers
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Dorset
    Posts
    274
    To make this more efficent create a public function in a module that calls the database property and then you only have to call that function.

    Module:
    Public Function MyPath()
    Dim db As Database, Doc As Document
    Set db = CurrentDb
    Set Doc = db.Containers("Databases")!userdefined
    MyPath = Doc.Properties!YourParameter
    End Function

    Your Code: Output File = MyPath\rpt1.snp

Please reply to this thread with any new information or opinions.

Similar Threads

  1. How do I set a link from a saved path
    By cowboy in forum Reports
    Replies: 5
    Last Post: 02-16-2010, 12:43 PM
  2. Programming the BackEnd path
    By James3mc in forum Programming
    Replies: 6
    Last Post: 11-21-2009, 06:39 PM
  3. relink to relative path TXT data files
    By tobynegus in forum Programming
    Replies: 0
    Last Post: 08-19-2008, 10:10 AM
  4. File path name using Transfer spreadsheet
    By JohnN in forum Import/Export Data
    Replies: 0
    Last Post: 11-14-2005, 06:57 AM
  5. How get path of executing database?
    By mscertified in forum Forms
    Replies: 3
    Last Post: 11-09-2005, 03:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums