Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Arrays and Types

Discussion in 'Information Technology' started by HSalim[MVP], Jul 28, 2006.

Tags:
  1. HSalim[MVP]

    HSalim[MVP]
    Expand Collapse
    Guest

    Hi,
    The help files in Access VBA for Type Statement say
    -----------

    User-defined types are often used with data records, which frequently
    consist of a number of related elements of different data types.

    The following example shows the use of fixed-size arrays in a user-defined
    type:

    Type StateData
    CityCode (1 To 100) As Integer ' Declare a static array.
    County As String * 30
    End Type

    Dim Washington(1 To 100) As StateData
    In the preceding example, StateData includes the CityCode static array, and
    the record Washington has the same structure as StateData.

    When you declare a fixed-size array within a user-defined type, its
    dimensions must be declared with numeric literals or constants rather than
    variables.

    -------------
    I Get an error: "can't assign to array" when I try this.

    Public Type xx
    xid(0 To 10) As Integer
    xname As String * 30
    xvalue As String * 255
    End Type

    Public Sub TestLevels()
    Dim levels(0 To 10) As xx
    levels.xid(1) = 1
    End Sub

    How can I use this?
    Thanks for any help/advice.
    Regards
    Habib
    --
    www.DynExtra.com
    A resource for the Microsoft Dynamics Community
    Featuring FAQs, File Exchange and more
    Current member count: 21

    --------------------------------------------

    Share your knowledge. Add your favorite questions and answers


    Help add questions to this site! We want Your input.
     
  2. Loading...

    Similar Threads Forum Date
    Humor 20 Types Of Gurdwara-Goers Blogs Nov 7, 2016
    Controversial Watch 3 Badass Women Destroy Stereotypes About Body Hair Hard Talk Aug 1, 2016
    Types of Karas Questions and Answers Sep 6, 2014
    How many different types of Sikhs are there? Sikh Sikhi Sikhism Jul 8, 2014
    Opinion Media Stereotypes and the 'Missing White Woman Syndrome" Breaking News May 9, 2013

  3. [MVP] S.Clark

    [MVP] S.Clark
    Expand Collapse
    Guest

    Maybe:

    Public Sub TestLevels()
    Dim levels(0 To 10) As xx
    levels(n).xid(1) = 1
    End Sub

    Where n=0 to 10??

    --
    Steve Clark, Access MVP
    FMS, Inc
    http://www.fmsinc.com/consulting
    Professional Access Database Repair
    *FREE* Access Tips: http://www.fmsinc.com/free/tips.html

    "HSalim[MVP]" <HSalim@msn.com> wrote in message
    news:uQfmsTycGHA.1324@TK2MSFTNGP04.phx.gbl...
    > Hi,
    > The help files in Access VBA for Type Statement say
    > -----------
    >
    > User-defined types are often used with data records, which frequently
    > consist of a number of related elements of different data types.
    >
    > The following example shows the use of fixed-size arrays in a user-defined
    > type:
    >
    > Type StateData
    > CityCode (1 To 100) As Integer ' Declare a static array.
    > County As String * 30
    > End Type
    >
    > Dim Washington(1 To 100) As StateData
    > In the preceding example, StateData includes the CityCode static array,
    > and the record Washington has the same structure as StateData.
    >
    > When you declare a fixed-size array within a user-defined type, its
    > dimensions must be declared with numeric literals or constants rather than
    > variables.
    >
    > -------------
    > I Get an error: "can't assign to array" when I try this.
    >
    > Public Type xx
    > xid(0 To 10) As Integer
    > xname As String * 30
    > xvalue As String * 255
    > End Type
    >
    > Public Sub TestLevels()
    > Dim levels(0 To 10) As xx
    > levels.xid(1) = 1
    > End Sub
    >
    > How can I use this?
    > Thanks for any help/advice.
    > Regards
    > Habib
    > --
    > www.DynExtra.com
    > A resource for the Microsoft Dynamics Community
    > Featuring FAQs, File Exchange and more
    > Current member count: 21
    >
    > --------------------------------------------
    >
    > Share your knowledge. Add your favorite questions and answers
    >
    >
    > Help add questions to this site! We want Your input.
    >
     
  4. HSalim[MVP]

    HSalim[MVP]
    Expand Collapse
    Guest

    thanks Steve!
    I could have sworn i tried that but obviously i did not.
    Regards
    Habib

    --
    www.DynExtra.com
    A resource for the Microsoft Dynamics Community
    Featuring FAQs, File Exchange and more
    Current member count: 21

    --------------------------------------------

    Share your knowledge. Add your favorite questions and answers


    Help add questions to this site! We want Your input.
    "[MVP] S.Clark" <steve.clark_NOSPAM@FMSInc.com> wrote in message
    news:%23pWTZRzcGHA.1264@TK2MSFTNGP05.phx.gbl...
    > Maybe:
    >
    > Public Sub TestLevels()
    > Dim levels(0 To 10) As xx
    > levels(n).xid(1) = 1
    > End Sub
    >
    > Where n=0 to 10??
    >
    > --
    > Steve Clark, Access MVP
    > FMS, Inc
    > http://www.fmsinc.com/consulting
    > Professional Access Database Repair
    > *FREE* Access Tips: http://www.fmsinc.com/free/tips.html
    >
    > "HSalim[MVP]" <HSalim@msn.com> wrote in message
    > news:uQfmsTycGHA.1324@TK2MSFTNGP04.phx.gbl...
    >> Hi,
    >> The help files in Access VBA for Type Statement say
    >> -----------
    >>
    >> User-defined types are often used with data records, which frequently
    >> consist of a number of related elements of different data types.
    >>
    >> The following example shows the use of fixed-size arrays in a
    >> user-defined type:
    >>
    >> Type StateData
    >> CityCode (1 To 100) As Integer ' Declare a static array.
    >> County As String * 30
    >> End Type
    >>
    >> Dim Washington(1 To 100) As StateData
    >> In the preceding example, StateData includes the CityCode static array,
    >> and the record Washington has the same structure as StateData.
    >>
    >> When you declare a fixed-size array within a user-defined type, its
    >> dimensions must be declared with numeric literals or constants rather
    >> than variables.
    >>
    >> -------------
    >> I Get an error: "can't assign to array" when I try this.
    >>
    >> Public Type xx
    >> xid(0 To 10) As Integer
    >> xname As String * 30
    >> xvalue As String * 255
    >> End Type
    >>
    >> Public Sub TestLevels()
    >> Dim levels(0 To 10) As xx
    >> levels.xid(1) = 1
    >> End Sub
    >>
    >> How can I use this?
    >> Thanks for any help/advice.
    >> Regards
    >> Habib
    >> --
    >> www.DynExtra.com
    >> A resource for the Microsoft Dynamics Community
    >> Featuring FAQs, File Exchange and more
    >> Current member count: 21
    >>
    >> --------------------------------------------
    >>
    >> Share your knowledge. Add your favorite questions and answers
    >>
    >>
    >> Help add questions to this site! We want Your input.
    >>

    >
    >
     

Share This Page