Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Subscript out of range Error Message

Posted on 2011-03-18
1
Medium Priority
?
337 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 2000 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

926 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