Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Mar 2009
    Location
    Hong Kong
    Posts
    359
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What's the Enum type in Access?
    Is it a data type or data structure?
    How is it usually used?
    Thanks.
    Armstrong

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Enum is not specific to Access; it is a way to define symbolic constants in VBA (and other programming languages) to make your code more readable. See Enumerated type on Wikipedia.

    This is an example from the Wikipedia article:

    Code:
    Enum CardSuit
       Clubs
       Diamonds
       Hearts
       Spades
    End Enum
     
    Sub EnumExample()
    	Dim suit As CardSuit
    	suit = Diamonds
    	MsgBox suit
    End Sub
    In this example, Clubs = 0, Diamonds = 1, Hearts = 2 and Spades = 3.

  3. #3
    3 Star Lounger
    Join Date
    Mar 2009
    Location
    Hong Kong
    Posts
    359
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='782849' date='03-Jul-2009 18:52']Enum is not specific to Access; it is a way to define symbolic constants in VBA (and other programming languages) to make your code more readable. See Enumerated type on Wikipedia.

    This is an example from the Wikipedia article:

    Code:
    Enum CardSuit
    	Clubs
    	Diamonds
    	Hearts
    	Spades
     End Enum
      
     Sub EnumExample()
    	 Dim suit As CardSuit
    	 suit = Diamonds
    	 MsgBox suit
     End Sub
    In this example, Clubs = 0, Diamonds = 1, Hearts = 2 and Spades = 3.[/quote]
    Hi Hans,
    Thanks for your explanation.
    What are the usual/popular applications for enum?
    Armstrong

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    There are lots of Enums built into VBA, but I think it's not much used by programmers.

Posting Permissions

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