Results 1 to 2 of 2
  1. #1
    Join Date
    May 2002
    Posts
    395

    Unanswered: setting a value to an global variable

    I would like to set a value to an variable so it is available to all procedures within the module in Declaration section of the module:

    Option Compare Database
    Option Explicit
    Dim field_list() As String, field_list_length As Integer
    Set field_list_length = 24

    I received this error “Invalid outside procedure”


    Thanks!!

  2. #2
    Join Date
    Jan 2003
    Location
    Rockville, MD
    Posts
    179
    Option Compare Database
    Option Explicit
    Dim field_list() As String
    Const field_list_length As Integer = 24


    You can't set the value of a variable in the declaration section. But if you want to change the value elsewhere, you can't use the "Const" declaration.

Posting Permissions

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