[AccessD] Syntax Problem with Array

Arthur Fuller fuller.artful at gmail.com
Sun Nov 28 14:37:58 CST 2021


Thanks Stuart,
That's the one I was looking for, in this shoddy memory bank.

On Sat, Nov 27, 2021 at 7:30 PM Stuart McLachlan <stuart at lexacorp.com.pg>
wrote:

> Another alternative that achieves the same effect (an immutable "array")
> :)
>
> Function LDoms(i As Integer) As Integer
>     LDoms = Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)(i - 1)
> End Function
>
> ...
> Debug.print LDom(2) ' returns 28
>
>
> On 27 Nov 2021 at 21:21, Gustav Brock via AccessD wrote:
>
> > Hi Arthur
> >
> > Nothing wrong, only is this not VBA syntax.
> >
> > You can do something like:
> >
> > <code>
> >     Const LDoms As String = "31, 28, 31, 30, 31, 30, 31, 31, 30, 31,
> >     30, 31" Dim LDom    As Integer
> >
> >     ´ Pick the 5th element.
> >     LDom = CInt(Split(LDoms, ",")(4))
> >
> >     Debug.Print LDom
> > </code>
> >
> > Fra: Arthur Fuller<mailto:fuller.artful at gmail.com>
> > Sendt: 27. november 2021 21:34
> > Til: Access Developers discussion and problem
> > solving<mailto:accessd at databaseadvisors.com> Emne: [AccessD] Syntax
> > Problem with Array
> >
> > 1. I'm trying to declare a Constant array. This is not working:
> >
> > Const LDoms() as Integer = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31,
> > 30, 31} I  get the same bad result if I use parentheses instead of
> > curly braces.
> >
> > What am I doing wrong?
> >
> >
> > --
> > Arthur
> >
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > https://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> >
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>


-- 
Arthur


More information about the AccessD mailing list