Results 1 to 4 of 4

Thread: How do I reasign a constant to a Variable

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    North East America
    Posts
    463

    Unhappy

    I have a constant
    Public Const gDataBaseName = "\\SRVR\shares\Action Request\Action Requestcon.mdb"
    This is where my Database resides. The problem is if the database moves I will have to go in and change code. To not have to do this I added an .ini file that I can change from within the program. How do I reasign that Constant to the new Variable? I need a constant because through out the program it is being called.

    Any comments would be appreciated

    Thanks Troy
    TMacPherson
    MIS Systems Engineer
    t_macpherson@yahoo.com


  2. #2
    Guest
    You can't reassign constant. You'd need to use a public or global variable for this purpose.

    Paul

  3. #3
    Fanatic Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    1,008
    You need to do this through API calls. You should also really be using the Registry by now.

    I can't remember the Registry API's but do a search for GetProfileString (the API to recall data from an .INI file) or WriteProfileString on the Microsoft site. That might be a good point to start. www.vbapi.com is very good as a complete reference to API calls, but you need to have at least an idea of what it's name is.

    Cheers,

    P.
    Not nearly so tired now...

    Haven't been around much so be gentle...

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    North East America
    Posts
    463
    Sorry paulw
    You must have miss-understood.. I know how to read and write to ini's and the registry I was just lookin to see if anyone had a way to reasign a constant to a new value. If you want to know how to write to the registry follow this link

    http://www.planetsourcecode.com/xq/A...s/ShowCode.htm
    TMacPherson
    MIS Systems Engineer
    t_macpherson@yahoo.com


Posting Permissions

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



Click Here to Expand Forum to Full Width