Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 30th, 2007, 02:41 AM
Registered User
 
Join Date: Jan 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Kapil
Default Not able to pass array as an argument to Let Prope

Hi,

I want to set the Let and Get property for an array variable. When i am trying to set the value for it, it gives me the error "Can't Assign to Array".. Please help me out to solve this problem. I need to do this using Properties.
Please find the code which i haev written attached with the message

Module function which calls the property
Code:
Public Sub populateScenarioDetails()

Dim objScnroDetails As classScenarioDetails
Set objScnroDetails = New classScenarioDetails
Dim scnroFocus(20) As String
Dim scnroFocusSel(200) As String

For index = 0 To Form_TSD_Input_Form.list_FocusRight.itemsSelected.Count - 1
    scnroFocus(index) = Form_TSD_Input_Form.list_FocusRight.itemsSelected.item(index)
Next index

objScnroDetails.setSelectedFocus = scnroFocus 'sets the Property with the array
scnroFocusSel = objScnroDetails.getSelectedFocus 'retrieves back the array from the property

End Sub
The Class Module containing the Property Functions
Code:
Private arrSelectedFocus(20) As String

Public Property Let setSelectedFocus(selectedFocus() As String)
    arrSelectedFocus = selectedFocus
End Property

Property Get getSelectedFocus() As String()
    getSelectedFocus = arrSelectedFocus
End Property
Please tell me what is the mistake which i am doing which is not letting me use the property functions in case of arrays.. This is working perfectly fine in case of individual variables.

Thanks & Regards,
Kapil


Kapil
 
Old January 30th, 2007, 09:30 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

This:

Dim scnroFocus(20) As String
Dim scnroFocusSel(200) As String

Should be:

Dim scnroFocus(20) As Variant
Dim scnroFocusSel(200) As Variant


mmcdonal





Similar Threads
Thread Thread Starter Forum Replies Last Post
xslt: pass index of array EefjeC XSLT 1 July 2nd, 2007 06:31 AM
how to pass an array in jsp to other js? lch Javascript 5 April 18th, 2006 06:56 AM
how to pass address of an array to a dll(in c++) iceman1188 General .NET 0 May 30th, 2004 09:19 PM
Pass an array between client and server pigtail Javascript 3 April 14th, 2004 12:42 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.