Results 1 to 16 of 16

Thread: data report question

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2005
    Posts
    122

    data report question

    hello,
    is there a way of adding a data report without requiring a data environment?
    i tried doing so but it said invalid data source.
    i only want the report to be stimulated from something i've entered on the report instead of from a database as my application wont be having one.

  2. #2
    Fanatic Member
    Join Date
    Oct 2005
    Posts
    586

    Re: data report question

    Short answer: No. Sorry.

  3. #3
    Hyperactive Member yousufkhan's Avatar
    Join Date
    Jan 2002
    Location
    India
    Posts
    492

    Re: data report question

    what exactly you want to do
    try passing the values at run time to datareport objects

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jul 2005
    Posts
    122

    Re: data report question

    since i dont have a database, i'll pre-enter data onto the report first.
    this is only for testing purposes just to give an idea on what the report would look like.

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

    Re: data report question

    Yes you can use a datareport without a dataenvironment. You just have to set the datasource at runtime.

    dim rsRpt As New ADODB.Recordset


    With rsRpt
    ' Create Recordset Fields (Columns) here
    .Fields.Append "groupid", adVarChar, 12
    .Fields.Append "meter", adVarChar, 12
    .Fields.Append "lastread", adDouble
    .CursorType = adOpenKeyset
    .LockType = adLockOptimistic
    .Open
    End With

    rsRpt.AddNew
    rsRpt!Groupid = "abc"
    rsRpt!meter = "xyz"
    rsRpt!lastread = 123.45
    rsRpt.Update
    End If

    With rptMeterlist
    ' Bind the Recordset to the Report
    Set .DataSource = rsRpt
    .DataMember = rsRpt.DataMember
    .Show vbModal
    End With
    set rsrpt=nothing

    add the text boxes to your report and set the datafield property to the fields in the recordset and leave the datamember property blank.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jul 2005
    Posts
    122

    Re: data report question

    this goes in the general declarations?

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

    Re: data report question

    This can go anywhere. I run alot of reports this way, usually from a command button. Just put the code in the click event.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Jul 2005
    Posts
    122

    Re: data report question

    i'm sorry but it says object not found:
    Set .DataSource = rsRpt

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

    Re: data report question

    Sounds like it can't find the datareport. Have you created the datarareport? Make sure your using the correct name.

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Jul 2005
    Posts
    122

    Re: data report question

    Quote Originally Posted by wes4dbt
    Sounds like it can't find the datareport. Have you created the datarareport? Make sure your using the correct name.
    what am i supposed to name it?

  11. #11
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,509

    Re: data report question

    With rptMeterlist
    ' Bind the Recordset to the Report
    Set .DataSource = rsRpt
    .DataMember = rsRpt.DataMember
    .Show vbModal
    End With

    In this example I have a datareport named rptMeterlist. When I used the report designer I left the datasource and datamember properties blank and then I assigned them at runtime, see above.

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Jul 2005
    Posts
    122

    Re: data report question

    so if i were to add textboxes, how do i put the values in?

  13. #13
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,509

    Re: data report question

    What ever you put in the recordset that you assign to the datareport.datasource will show up on the report.

  14. #14
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,509

    Re: data report question

    I attached a demo program that show how to use a data report without a dataenvironment. I hope this helps

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

    Re: data report question

    Moved to reporting

  16. #16

    Thread Starter
    Lively Member
    Join Date
    Jul 2005
    Posts
    122

    Re: data report question

    Quote Originally Posted by wes4dbt
    I attached a demo program that show how to use a data report without a dataenvironment. I hope this helps
    thank you very much. i'll have a look at it.

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