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

    Can i make a string constant? (Access 2000)

    Can i make a string constant? I want to use a string in 5 places, as a record source in forms and reports,
    and also i use it in some If constructions.The string is the following :


    strOffers = "SELECT [tblOffers].[offerid], [tblOffers].[offerdate], [tblClients].[CompanyName],

    [tblClients].[City], [tblClients].[kindid], [tblOffers].[EmployeeID], [tblClients].[ClientID], [tblClients].[afid] " &

    _
    " FROM tblClients INNER JOIN tblOffers ON [tblClients].[ClientID]=[tblOffers].[Clientid] " & _
    " where (((Year([offerdate])) = " & CnstYear & "))"


    For example, i would like to use it as:
    Me.RecordSource = strBasOffers

    also i use it in If construction to define different record sources.
    I would like therefore to put the string as a consants in the modules sections,where i have other constants

    too.Is it possible?

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

    Re: Can i make a string constant? (Access 2000)

    If you want the constant to be available in several forms and reports, declare it as a public constant in a general module:

    Public Const strOffers = "SELECT [tblOffers].[offerid], [tblOffers].[offerdate], [tblClients].[CompanyName], " & _
    "[tblClients].[City], [tblClients].[kindid], [tblOffers].[EmployeeID], [tblClients].[ClientID], [tblClients].[afid] " & _
    " FROM tblClients INNER JOIN tblOffers ON [tblClients].[ClientID]=[tblOffers].[Clientid] " & _
    " where (((Year([offerdate])) = " & CnstYear & "))"

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

    Re: Can i make a string constant? (Access 2000)

    Thank you !!! it works great now !

Posting Permissions

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