[AccessD] Problems with Arrays

John Colby jwcolby at gmail.com
Wed Jan 18 15:45:40 CST 2023


What I neglected to state is that when passing a pointer to an object, you
do not need to use the ByRef keyword in the parameter.

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.
>
>
> https://learn.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/procedures/passing-arguments-by-value-and-by-reference
>
> 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>
> wrote:
>
>> Are we talking VBA or another language? I seldom use the word "pointer" in
>> 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... Can
>> > > 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
>


-- 
John W. Colby
Colby Consulting


More information about the AccessD mailing list