Results 1 to 10 of 10

Thread: [RESOLVED] Pls. Help with DataReport1 - "Invalid Data Source"

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2006
    Posts
    53

    Resolved [RESOLVED] Pls. Help with DataReport1 - "Invalid Data Source"

    Hello Everyone,

    Im trying to to assign a value, lets say "This is my text", to a label1 on my
    datareport1, and it raised an error "Invalid Data Source"...

    my code here
    Code:
    DataReport1.Sections("Section2").Controls("Label1").Caption = "This is my Text"
    even this also raised the same error
    Code:
    DataReport1.Sections("Section2").Controls("Label1").Caption = form1.Label1.Caption
    How could i change the caption of Label1 in DataReport1 at runtime???

    No, I dont want that DataReport1.DataSource be assign to any database, i only want that Label1.Caption, or any controls therein to be change at runtime, is that possible?

    Thank you for any reply...
    I'm maybe a noob now, but with your help, i would become an expert someday

  2. #2
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: Pls. Help with DataReport1 - "Invalid Data Source"

    Are you sure its a label and not a textbox? Did you set the labels before opening the report?

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2006
    Posts
    53

    Re: Pls. Help with DataReport1 - "Invalid Data Source"

    Yap, im sure its a Label, and i put it already on the datareport before opening it...
    I'm maybe a noob now, but with your help, i would become an expert someday

  4. #4
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: Pls. Help with DataReport1 - "Invalid Data Source"

    Are you referencing an instance of the report, or the report itself?

  5. #5

    Thread Starter
    Member
    Join Date
    Jul 2006
    Posts
    53

    Re: Pls. Help with DataReport1 - "Invalid Data Source"

    Im referencing an object on the DataReport1 which is Label1(RptLabel) which is on Page Header(Section2) and want to change its caption during runtime...
    I'm maybe a noob now, but with your help, i would become an expert someday

  6. #6
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: Pls. Help with DataReport1 - "Invalid Data Source"

    Did you do this?
    Code:
    Dim repRef As MyDateReport1
       Set repRef = New MyDataReport1
    That ensures your working with an unopened data report. http://www.vbforums.com/showthread.p...ataenvironment

    Or did you reference MyDataReport1 directly?

  7. #7
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,515

    Re: Pls. Help with DataReport1 - "Invalid Data Source"

    I usually do in the datareport_initialize event.

    Code:
    rptAdjust_Invoices.Sections("Invtemp_Header").Controls.Item("lblCsz").Caption = "some text"

  8. #8
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Pls. Help with DataReport1 - "Invalid Data Source"

    Moved

  9. #9
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,515

    Re: Pls. Help with DataReport1 - "Invalid Data Source"

    Did you notoce the syntax is different than yours? Text boxes and labels are different in the way you assign data.

  10. #10

    Thread Starter
    Member
    Join Date
    Jul 2006
    Posts
    53

    Re: Pls. Help with DataReport1 - "Invalid Data Source"

    Ok, Thank you guys, i figure it now...
    I'm maybe a noob now, but with your help, i would become an expert someday

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