Results 1 to 6 of 6

Thread: Generating Reports from Forms to a Report

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Philippines
    Posts
    177

    Wink Generating Reports from Forms to a Report

    Please help me generate reports from the forms to crystal or data report.. i have the details in the text boxes and i dont need database to put it into. i justi need to pass it on a report using crystal report 6.0 or data report for printing purposes . Thanx

  2. #2
    Frenzied Member d3gerald's Avatar
    Join Date
    Jan 2006
    Posts
    1,348

    Re: Generating Reports from Forms to a Report

    well thats kinda easy thing. you can set the value of each control you want to like this

    VB Code:
    1. DataReport1.Sections("SectionNameAsString").Controls("ControlNameAsString").Caption = "Your Value"   'you may use .Caption for labels

    but theres one problem with data report, you need to connect it to a recordset so that you can run it. you can open a recordset as dummy or you may have it contain data without connecting it to the database, try a search
    On error goto Trap

    Trap:
    in case of emergency, drop the case...

    ****************************************
    If this post has been resolved. Please mark it as "Resolved" by going through the "Thread Tools" above and clicking on the "Mark Thread Resolved " option.
    if a post is helpful to you, Please Rate it by clicking on the Rate link right below the avatar

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Philippines
    Posts
    177

    Exclamation Re: Generating Reports from Forms to a Report

    thanks d3gerald.. can u give me a sample code for that.. i placed in Details(section1) a label and i need to get values from my first form(using textboxes) to datareport1. thanx!
    Last edited by popodc; Apr 3rd, 2006 at 09:18 PM.

  4. #4
    Frenzied Member d3gerald's Avatar
    Join Date
    Jan 2006
    Posts
    1,348

    Re: Generating Reports from Forms to a Report

    VB Code:
    1. Dim rsTemp As New ADODB.Recordset
    2.  
    3. rsTemp.ActiveConnection = Nothing
    4. rsTemp.CursorLocation = adUseClient
    5. rsTemp.LockType = adLockBatchOptimistic
    6.    
    7. 'create some fields
    8. rsTemp.Fields.Append "Field1", adChar, 50
    9. rsTemp.Fields.Append "Field2", adVarChar, 50
    10. 'you may create more here
    11. rsTemp.Open
    12.    
    13. 'add a record
    14. rsTemp.AddNew
    15. rsTemp.Fields(0) = "Value1"
    16. rsTemp.Fields(1) = "Value2"
    17. rsTemp.Update
    On error goto Trap

    Trap:
    in case of emergency, drop the case...

    ****************************************
    If this post has been resolved. Please mark it as "Resolved" by going through the "Thread Tools" above and clicking on the "Mark Thread Resolved " option.
    if a post is helpful to you, Please Rate it by clicking on the Rate link right below the avatar

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Philippines
    Posts
    177

    Re: Generating Reports from Forms to a Report

    hanks d3gerald.. can u give me a sample code for that.. i placed in Details(section1) a label and i need to get values from my first form(using textboxes) to datareport1. thanx!

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Philippines
    Posts
    177

    Re: Generating Reports from Forms to a Report

    Quote Originally Posted by d3gerald
    well thats kinda easy thing. you can set the value of each control you want to like this

    VB Code:
    1. DataReport1.Sections("SectionNameAsString").Controls("ControlNameAsString").Caption = "Your Value"   'you may use .Caption for labels

    but theres one problem with data report, you need to connect it to a recordset so that you can run it. you can open a recordset as dummy or you may have it contain data without connecting it to the database, try a search

    how will i know the controls?? i tried it but up to controls(1) and controls(2) only works?? how can i put controls?

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