Results 1 to 2 of 2
  1. #1
    ngruson is offline Novice
    Windows XP Access 2003
    Join Date
    Apr 2010
    Posts
    6

    Array of labels in runtime

    I want to make an array of labels in runtime. The captions of the labels are set at runtime.
    This is what I have:

    Dim ctrlArray(0 To 24) As Label
    ctrlArray(0) = lblWeek1_Monday
    ctrlArray(1) = lblWeek1_Tuesday


    etc...

    The second line gives an error: The object variable is not set.
    What am I doing wrong here?

  2. #2
    trb5016 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Location
    Pennsylvania
    Posts
    71
    Try this:

    Set ctrlArray(0) = lblWeek1_Monday
    Set ctrlArray(1) = lblWeek1_Tuesday


    Don't forget to clean up before your code exits with

    Set ctrlArray(0) = Nothing
    Set ctrlArray(1) = Nothing

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

Similar Threads

  1. Show array of bytes as picture in form
    By HZwaan in forum Forms
    Replies: 0
    Last Post: 06-17-2010, 04:07 AM
  2. Building Array
    By jgelpi16 in forum Forms
    Replies: 12
    Last Post: 03-22-2010, 12:33 PM
  3. Labels
    By MFS in forum Programming
    Replies: 2
    Last Post: 01-28-2010, 07:01 AM
  4. How to use array? [ solved] Thanks.
    By wasim_sono in forum Programming
    Replies: 0
    Last Post: 10-20-2006, 12:00 AM
  5. cannot print labels
    By Diane in forum Database Design
    Replies: 4
    Last Post: 12-29-2005, 08:19 AM

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