[AccessD] Problems with Arrays
fuller.artful at gmail.com
Thu Jan 19 08:04:11 CST 2023
I read the page you cited, and copied the code that demonstrates byVal v.
ByRef. This code might work in VB but Access VBA sure doesn't like it.
Seems the problem is in the declarations, such as:
Dim lowRate = highRate * 0.6
Dim initialDebt = 4999.99
' Make a copy of the original value of the debt.
Dim debtWithInterest = initialDebt
All three Dim statements are flagged in red-underline. This does not
surprise me since I've never seen variables declared that way; rather, they
are declared and assigned values on separate lines.
Am I missing something? Wouldn't be the first time.
On Wed, Jan 18, 2023 at 4:43 PM John Colby <jwcolby at gmail.com> wrote:
> I was under the impression that any time you pass any parameter ByRef you
> were passing in a pointer.
> The third para states:
> For reference types, only the pointer to the data is copied (four bytes on
> 32-bit platforms, eight bytes on 64-bit platforms). Therefore, you can pass
> arguments of type String or Object by value without harming performance.
> Furthermore AFAIK objects in VBA can *only* be passed ByRef. For example
> passing a text box into a function.
> On Wed, Jan 18, 2023 at 1:13 PM Arthur Fuller <fuller.artful at gmail.com>
> > Are we talking VBA or another language? I seldom use the word "pointer"
> > discussions of VBA, because VBA doesn't implement pointers, at least not
> > that I know of (as in C and C++). So what exactly do you mean? I am very
> > curious to learn this technique.
> > On Tue, Jan 17, 2023 at 4:35 PM Stuart McLachlan <stuart at lexacorp.com.pg
> > wrote:
> > > On 17 Jan 2023 at 14:34, Arthur Fuller wrote:
> > >
> > > > One question, before I load my revolver and do something stupid...
> > > > a function return an array? If so, I can work with that and get where
> > > > I need to go.
> > > >
> > > Not directly, but:
> > > A function can return a Variant and a Variant can contain an array
> > > Or a function can accept or return a pointer to an array
> > >
> > > --
> > > AccessD mailing list
> > > AccessD at databaseadvisors.com
> > > https://databaseadvisors.com/mailman/listinfo/accessd
> > > Website: http://www.databaseadvisors.com
> > >
> > --
> > Arthur
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > https://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> John W. Colby
> Colby Consulting
> AccessD mailing list
> AccessD at databaseadvisors.com
> Website: http://www.databaseadvisors.com
More information about the AccessD