Results 1 to 3 of 3

Thread: Subscript out of range error

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2003
    Location
    USA
    Posts
    2

    Question Subscript out of range error

    I have a data report that is not connected to a datasource, etc. until runtime. On this report I am using text fields which I try to bind at run time. I keep getting a "Run time error '9': Subscript out of range" error on the lines referencing the text fields. I have verified my section number and spelling. Any ideas on what is causing this error? Here is my code:

    Set drServCostAcctRpt.DataSource = DE
    drServCostAcctRpt.DataMember = "ServiceCostAnalysis"
    'set fields on report
    drServCostAcctRpt.Sections(1).Controls.Item("txtService").DataField = "Service"
    drServCostAcctRpt.Sections(1).Controls.Item("txtService").DataMember = "ServiceCostAnalysis"
    drServCostAcctRpt.Sections(1).Controls.Item("txtWCost").DataField = "TotalCost"
    drServCostAcctRpt.Sections(1).Controls.Item("txtWCost").DataMember = "ServiceCostAnalysis"

    Thanks in advance!

  2. #2
    Fanatic Member SkiNLaB's Avatar
    Join Date
    Jan 2002
    Location
    Sydney, Australia
    Posts
    747
    thats pretty much telling u that section(1) doesnt exist i guess. i think i have found section numbers to be all over the place, so try zero, or 2 or 3 even, or loop through the sections in the collection, and find out the numbers that are available.

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2003
    Location
    USA
    Posts
    2
    Thanks! That was it. Even though the report said section1 it had an index of 3.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width