Solved

Subscript out of range Error Message

Posted on 2011-03-18
1
330 Views
Last Modified: 2012-05-11
Hi,

I have a function that which used to include this line:

varParts_GBL_identifier = Split(Forms!fdlgMain.tvw1.SelectedItem, " | ")

To enable the function to execute its code on more than one control I changed it so that it would accept a parameter.

The function is now called like this:

Call PopulateGlobal("Forms!fdlgMain.tvw1.SelectedItem")

and the previous line has been replaced with this:

varParts_GBL_identifier = Split(strControl, " | ")

(strControl is the string parameter)

Unfortunately this now produces this error message:

Error 9: Subscript Out Of Range

Any suggestions as to why its giving this error message?
0
Comment
Question by:andyw27
1 Comment
 
LVL 17

Accepted Solution

by:
JezWalters earned 500 total points
ID: 35164333
It looks like you're passing the string "Forms!fdlgMain.tvw1.SelectedItem" to your procedure, not the value of the control.  Try changing the Call to:

    Call PopulateGlobal(Forms!fdlgMain.tvw1.SelectedItem)
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Access 2016 7 35
Trying to get public variables with login info accessible across entire project. 2 18
Top 1 of each supplier 55 58
Question about DB Schema 27 56
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question