Results 1 to 8 of 8

Thread: how can i pass a variable to crystal report

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    278

    how can i pass a variable to crystal report

    hi all,

    am using crystal report 8.0, vb6.0 with Msaccess 2000 and ADODB. actually i did a report with all the fields coming from a table, and it is working fine . but one field still there blank and i want to fill that field that is coming from another table and these both tables didnt made any relationship. i want to know how can i pass the value of the variable to crystal report

    thnx in advance

    saj

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: how can i pass a variable to crystal report

    If you create a parameter in CR and then use the Parameters collection in vb6 to add and pass it to the report.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    278

    Re: how can i pass a variable to crystal report

    Quote Originally Posted by RobDog888
    If you create a parameter in CR and then use the Parameters collection in vb6 to add and pass it to the report.
    thanx for the reply
    can u just brief parameters collection in VB6 and how can i create parameter in CR

    saj

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: how can i pass a variable to crystal report

    In CR's Field Explorer, create a new Parameter Field and drag it to your report where you want the passed in parameter to be displayed. Then in VB6 add a reference to CXDRT or whatever it is, cant exactly remember but I do have a small example in my signature. Then under the report object is the parameters collection. Add the parameter and pass it and then set your datasource and display.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5
    Addicted Member mabbas110's Avatar
    Join Date
    Oct 2005
    Location
    Karachi , Pakistan
    Posts
    172

    Re: how can i pass a variable to crystal report

    You have two options

    1. Just get that value by running command at the form level and then pass it on the formula field of crystal report

    2. IF u r using the table for crystal report than try to use query and then in that query embed the sub query and get that field from another table.

    I hope this may help u
    Thanks and Regards,

    Muhammad Abbas

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    278

    Re: how can i pass a variable to crystal report

    Quote Originally Posted by mabbas110
    You have two options

    1. Just get that value by running command at the form level and then pass it on the formula field of crystal report

    2. IF u r using the table for crystal report than try to use query and then in that query embed the sub query and get that field from another table.

    I hope this may help u
    can u pls explain this suggestion. by the time i will check robdogg's suggestion

    saj

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    278

    Re: how can i pass a variable to crystal report

    hi all,

    i made a parameter field in CR. now my doubt is.. how can i get the value for that field from my present active VB form. bcs am using Crsytal report version 8.0 , it is not supporting some of the methods discussed by the posters in some other thread.


    Set m_Rep = m_App.OpenReport(mRepName, 1)
    m_rep.ParameterFields.GetItemByName("Owner").AddCurrentValue (gstrMarker)

    this is the one am trying , but its not working

    can anybody tell me the solution pls
    saj

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: how can i pass a variable to crystal report

    Use the Patameters collection if you have it in 8.0.
    With 8.5 I found that you needed to clear the parameter first before adding each one. Not sure if its the same in 8.0
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

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