Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Public constant (Access 2000)

    I am declaring a string as public like that:
    Public StrPassword As String
    I am writing separately in each of my codes the password say
    StrPassword = "secret"
    Can i declare this also only once, after the declaration of the StrPassword?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Public constant (Access 2000)

    You can define strPassword as a constant in a standard module (i.e. the type of module by clicking New in the Modules section of the database window):

    Public Const strPassWord = "secret"

    By making it a constant, you cannot modify the value any more, so you must remove all lines that set the password

    strPassword = "secret"

    for they would cause a compile error ("Assignment to constant not permitted")

Posting Permissions

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