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

    Constants (Access 2000)

    I have the following constants:

    Public Const jan As String = "Month(invoicedate)= 1 and year(invoicedate) = 2001"
    Public Const feb As String = "Month(invoicedate)= 2 and year(invoicedate) = 2001"
    etc
    etc

    Instead i want to place only the figure of the year as constant but i fail to do this.
    I have tried the following:

    Dim CnstYear as Integer
    CnstYear = 2001
    Public Const jan As String = "Month(invoicedate)= 1 and year(invoicedate) & CnstYear"
    But on opening the report i receive the message missing paaremetr value.
    Do i miss something in my code?

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Constants (Access 2000)

    You can't create dynamic constants, that's a contradiction in terms. Leave the year off the constants. Then just concatenate the year to the string when you use the constant. The alternative is to do the following and change the CnstYear value each time you want to change the year.

    CnstYear = 2001
    Public Const jan As String = "Month(invoicedate)= 1 and year(invoicedate) = " & CnstYear
    Charlotte

  3. #3
    2 Star Lounger
    Join Date
    Nov 2001
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Constants (Access 2000)

    i feel obliged to thank you for your nice and elegant answer
    Regards

Posting Permissions

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