Results 1 to 2 of 2
  1. #1
    emmahope206 is offline Novice
    Windows XP Access 2003
    Join Date
    May 2011
    Posts
    5

    Declaring a Variable Constant (Sort Of)

    All,

    I need your help. I have the following scenario in Access 2003.



    • Module1 - contains a extensive list of Public Constants such as file paths, file names etc
    • Module2+ - contain extensive coding that is used for many reasons


    Please note i cannot change Module2+, add modules or change the incoming file name.

    The problem is as follows, we now have a file that contains a date stamp in the name. Essentially I need to do the following:

    • Public Const str2ImportFileDay1 = "ESD Cust Feedback trial" & format(date, "yy-mm-dd") & ".xls"


    I know I can't do this, I know I can declare a Public Variable and define the value in the subsequent modules but this isn't possible as I can't change the subsequent modules.

    Can someone advise a way around this?

    Thank you for your help.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I don't think the code in Module2+ care if the str2ImportFileDay1 entity is a constant or variable.

    Maybe declare str2ImportFileDay1 as a public variable then in some code that executes when db opens set its value. Problem with this is interruption of code execution will wipe out the variable value.

    Only other thing I can think of is custom classes/collections, something I've never done.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 5
    Last Post: 06-01-2012, 03:59 PM
  2. divide value by a constant and populate same field
    By ridgeview80 in forum Queries
    Replies: 5
    Last Post: 05-28-2012, 09:37 AM
  3. Error Declaring FK and PK on same Line
    By jo15765 in forum SQL Server
    Replies: 0
    Last Post: 01-21-2012, 04:29 PM
  4. Replies: 2
    Last Post: 06-23-2010, 06:37 PM
  5. Replies: 1
    Last Post: 06-09-2010, 04:19 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