Results 1 to 2 of 2
  1. #1
    MattLewis is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Posts
    17

    How to declare literal array in VBA

    I can't figure out how to declare a literal array in VBA. According to MSDN documentation, it should be:



    Code:
    Dim numbers = New Integer() {1, 2, 4, 8}
    But that's giving me an error that says "Compile error: Expected: end of statement at the "=" sign.

    I'm thinking that I might be looking at the wrong "Visual Basic" in MSDN, so if someone has an object reference for the VBA that's in Access specifically, that would help. Google keeps giving me......something else.

  2. #2
    MattLewis is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Posts
    17
    I ended up using the Array function.

    Code:
    Dim numbers() as Integer
    Numbers = Array(1, 2,4, 8)
    That's just cheesy if that's how VB does arrays

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Date was defined as a 'Literal'
    By johnson8809 in forum Queries
    Replies: 2
    Last Post: 02-21-2015, 06:02 PM
  2. Replies: 5
    Last Post: 03-14-2014, 03:05 PM
  3. Replies: 1
    Last Post: 10-29-2012, 03:07 PM
  4. Replies: 5
    Last Post: 05-29-2012, 08:50 PM
  5. How to Declare Const in Access VBA
    By ped in forum Access
    Replies: 9
    Last Post: 08-07-2011, 12:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums