Calling a report that have dynamic parameter from vba

i have this report that have a dynamic parameter , when i call from my application using vba it aske for server name , user id  and password , even i have provided the connection string right , so if there is diffrent way to do it can you tell me , because this is killing me from over a month
i have attached the a screen shot and the code is following
thanks
Dim cn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim userinfo As New RetrieveGlobals9.retrieveuserinfo
Dim strsql, sqlDataSource, pwd, userId1, constring, interCompanyID As String
Dim path, userf, userto As String
Public application As New CRAXDRT.application
Public report As New CRAXDRT.report
Private Sub CUPRPayrollReports_Initialize()
    sqlDataSource = userinfo.sql_datasourcename
    userId1 = userinfo.retrieve_user
    pwd = "sql"
    interCompanyID = "ASCTR"
End Sub
Private Sub DepartmentWisePrint_Changed()
CUPRPayrollReports_Initialize
  path = "C:\Program Files\Microsoft Dynamics\GP\departmentWise.rpt"
  Set cn = New ADODB.Connection
  constring = "Provider=MSDASQL" & _
             ";Data Source=" & sqlDataSource & _
             ";User ID=" & userId1 & _
             ";Password=" & pwd & _
             ";Initial Catalog=" & interCompanyID
  With cn
      .ConnectionString = constring
      .CursorLocation = adUseNone
      .Open
   End With
Set rst = New ADODB.Recordset
strsql = "SELECT * FROM DepWise"
rst.Open strsql, cn, adOpenDynamic, adLockOptimistic, adCmdText
Set report = application.OpenReport(path, 0)
report.Database.SetDataSource rst, 3, 1
report.EnableParameterPrompting = True
ReportViewer.CrystalActiveXReportViewer1.ReportSource = report
ReportViewer.Top = 0
ReportViewer.Left = 0
ReportViewer.Height = 500
ReportViewer.Width = 760
ReportViewer.ScrollBars = fmScrollBarsBoth
ReportViewer.CrystalActiveXReportViewer1.Top = 0
ReportViewer.CrystalActiveXReportViewer1.Left = 0
ReportViewer.CrystalActiveXReportViewer1.Height = 500
ReportViewer.CrystalActiveXReportViewer1.Width = 750
ReportViewer.CrystalActiveXReportViewer1.EnableGroupTree = False
ReportViewer.CrystalActiveXReportViewer1.EnableRefreshButton = True
ReportViewer.CrystalActiveXReportViewer1.EnableExportButton = True
ReportViewer.CrystalActiveXReportViewer1.EnablePrintButton = True
ReportViewer.CrystalActiveXReportViewer1.ViewReport
'If ReportViewer.Visible = False Then ReportViewer.Show
'If ReportViewer.Visible = False Then
ReportViewer.Show
Set rst = Nothing
Set cn = Nothing
End Sub

How many tables is there in the report? And, do you have any subreports? I'd recommend gaining experience with this by creating as simple a report as possible - one table - one field, create a recordset, pass that to this report. Does it work? It should. Now we have a bit of confidence and experience, so increase the complexity. But let me know answers to the two Qs above.
Ludek

Similar Messages

  • Uploading reports that use dynamic parameter values

    Post Author: singhal
    CA Forum: Deployment
    Hi,
    I am having difficulty using Crystal Reports Server XI to deploy reports that were made in Crystal Reports XI.
    When I create a report that uses a dynamic parameter listing, I get the follow error when I try to install it onto the server:
    Failed to read data from report file C:\WINDOWS\Temp\myreport.rpt. Reason: Failed to read parameter object
    But if I were to use a static parameter listing, the server will load up the report just fine.  Can you please tell me what I am doing wrong and I need to do to fix the problem.  As many details as possible would be helpful.
    Thanks,
    Back

    Post Author: TAZ
    CA Forum: Deployment
    Does the issue happen with the built in administrator account? I believe this is a permissions issue and the permissions need to be set in business views.
    Regards,
    Tim

  • Getting letters for items that have been removed from my credit report

    I have gotten several credit cards in the past month as I have been working on rebuilding my credit. Over the past few weeks I have been receiving letters from collection agencies for items that have been removed from my credit report. Has anyone else had this issue? Should I just throw this stuff away since it's not longer being reported on my credit report and the collections are so old they've been removed from the report? I am freaking out a bit. Any advice is welcome.

    wonderwoman1970 wrote:
    They were removed because they are over 8 years old.They can still try to collect, they just cannot place it on your reports. If its also beyond SOL in your state, you have to option to sent them a Cease Communications letter, charmingly refferred to as a FOAD letter. (Google it to find the meaning of that acronym).They will just sell it to another JDB, who may send you another collection notice. Keep all correspondence regarding this debt in order to keep track of it. You also have the option to settle it for a small percentage - I would suggest offering no more than 5-10% of the original amount (not some inflated "new balance"), and in your offer letter refer to it as "old, time barred debt, that is not a current financial obligation" but that you are willing to settle only to close out the account.

  • EL - How do you call a method that requires a parameter

    How do you call a method that requires a parameter
    In scriplet code here is what I am trying to do
    <%= car.getDefaultColor(car.getCarType()) %>
    How do I do this in EL
    Here is my guess (it generates the Exception described below)
    ${car.defaultColor(car.carType)}
    Here is the Exception I am getting:
    javax.servlet.ServletException: <h3>Validation error messages from tag library c</h3>tag = 'out' / attribute = 'value': An error occurred while parsing custom action attribute "value" with value "${car.defaultColor(car.carType)}": Encountered "(", expected one of ["}", ".", ">", "gt", "<", "lt", "==", "eq", "<=", "le", ">=", "ge", "!=", "ne", "[", "+", "-", "*", "/", "div", "%", "mod", "and", "&&", "or", "||"]
    Any Ideas?
    P.S. If it matters to you, I am using JSTL 1.0 and the code snippets above are actually within the value attribute of a <c:out value="" /> statement.

    How do you call a method that requires a parameter
    In scriplet code here is what I am trying to do
    <%= car.getDefaultColor(car.getCarType()) %>
    How do I do this in ELYou don't. EL is very strict in method signatures. All get methods must be public Type getProperty(void); And all set methods must be public void setProperty(Type t);
    So you will have to re-work your Bean so it does not need an argument to the get method (getDefaultColor()). Since you are calling another method out of car, you might re-write the getDefaultColor method as such:
      public Object getDefaultColor() {
        CarType ct = this.getCarType();
        //then do other stuff
      }If that isn't suitable, then provide a helper method that is used to set the current car type and then call the getDefaultColor:
      private CarType curCarType;
      public void setCurrentCarType(CarType ct) { curCarType = ct; }
      public Object getDefaultColor() {
        if (curCarType == null) throw new IllegalStateException("CarType must be set before getting color");
        //normal work using curCarType
    <c:set target="${car}" property="currentCarType" value="${car.carType}"/>
    <c:out value="${car.defaultColor}"/>It is better to do as little of the data manipulation (setting up the car type) in the JSP as possible, so the first option is better than the second. Also better then the second would be to set the current car type in a servlet or data access object (or wherever) from which your retreive the car to begin with. Manipulatig it in the JSP itself should be your last resort (to keep as much business logic out of the JSP as possible).
    Here is my guess (it generates the Exception
    described below)
    ${car.defaultColor(car.carType)}
    Here is the Exception I am getting:
    javax.servlet.ServletException: <h3>Validation error
    messages from tag library c</h3>tag = 'out' /
    attribute = 'value': An error occurred while parsing
    custom action attribute "value" with value
    "${car.defaultColor(car.carType)}": Encountered "(",
    expected one of ["}", ".", ">", "gt", "<", "lt",
    "==", "eq", "<=", "le", ">=", "ge", "!=", "ne", "[",
    "+", "-", "*", "/", "div", "%", "mod", "and", "&&",
    "or", "||"]
    Any Ideas?
    P.S. If it matters to you, I am using JSTL 1.0 and
    the code snippets above are actually within the value
    attribute of a <c:out value="" /> statement.

  • How to call a class that extends a frame from a panel ?

    How to call a class that extends a frame from a panel ?
    I am trying to create an application say "Videoshow"
    Videoshow has a panel which in turn consists of 2 components : 1]a textarea( to show the contents of a page) and 2] a mediaclip(to show the video).
    Now I have an application "MediaApplication"(to show the videoclip) which extends Frame (Code from Java 2 Unleashed, Chap 21). I want to show this MediaApplication in Component 2 of the above panel. But when I do this, I only see the MediaApplication frame instead of the whole SlideShow.
    I want to do something likethis.
    VideoShow :
    |---------------------------------|-------------------|
    | |
    | (Comp 1) | (Comp 2)
    | TEXTAREA | Video Clip
    | |(MediaApp entends Frame)
    |---------------------------------|-------------------|
    What is the best way to achieve this ? Also which component can I use to show the videoclip ?

    im not familiar with the code you mention from Java 2 Unleashed, but your best bet is to read up on Swing a bit - so you get an idea of how Swing containers and components work - then im sure you'll find a solution to your problems. Then if you encounter any difficulties whilst your attempting to do that, post your code in the Swing forum and im sure someone will help you.

  • When I view my ipohotos on my macair that have been uploaded from my iphone, sometimes my compute just shuts down. It is when I have the iphoto open. I'm not sure which version this is...I bought the computer about four months ago.

    When I view my ipohotos on my mac air that have been uploaded from my iphone, sometimes my computer just shuts down. It is when I have the iphoto open. I'm not sure which version this is...I bought the computer about four months ago.

    adkennon wrote:
    And maybe you don't talk to too many people but I've been on many forums on different websites where people have had similar problems and a lot of people in the store were having battery problems where they were draining too fast. What I learned is that all the people who did not download the updates are good. There phone is working the same. The people who have, they're having battery problems
    I have downloaded every update and my battery life is better than any previous iPhone I have ever owned. I see posts from hundreds of people every day, and this is not a commonly reported problem. While there are a few random reports of battery problems, it is no more than I have seen for any other model or any other version of iOS in almost 8 years. Usually problems of rapid battery drain can be traced to bad apps (FaceBook is the worst offender) or corrupt data being synced from iCloud or other sources (gmail, Windows Live, Yahoo, etc).
    The simple test is to restore the phone as New. Do not create any email accounts. Do not install any apps. Do not enable FaceTime or iMessage. Do not enable Twitter or any other social networking app. Use it for a day and check the battery usage. You will find that it is working well.
    And also see this: http://www.overthought.org/blog/2014/the-ultimate-guide-to-solving-ios-battery-d rain. It is the best treatise I have seen on the subject of battery usage.

  • HT201272 I purchased several older James Bond movies 2 years ago that have all disappeared from my iTunes and are no longer available. Will I be refunded for these items?

    I purchased several older James Bond movies 2 years ago that have all disappeared from my iTunes and are no longer available. Will I be refunded for these items?

    No you won't be refunded, it's your responsibility to keep copies of your purchases. Have you not got copies of them on backups ?

  • I upgraded to Firefox 4.0 and my "Hide Unvisited" add-on longer works. is there a compatable replacement? This hides pages that have been bookmarked from appearing in the Awesome Bar since deleting or clearing cookies. Please help.

    I upgraded to Firefox 4.0 and my "Hide Unvisited" add-on no longer works. is there a compatible replacement? This hides pages that have been bookmarked from appearing in the Awesome Bar since deleting or clearing cookies. I was hoping maybe there was an option for this in Firefox itself but I don't see one. Please help.

    I upgraded to Firefox 4.0 and my "Hide Unvisited" add-on no longer works. is there a compatible replacement? This hides pages that have been bookmarked from appearing in the Awesome Bar since deleting or clearing cookies. I was hoping maybe there was an option for this in Firefox itself but I don't see one. Please help.

  • How can i delete photos that have been synced from my computer to my i-pad?

    I want to delete photos that have been copied from my computer to my i-pad,i can delete albums but not phots?

    If photos were synced from your computer then they can't be deleted directly on the iPad, you will need to remove/de-select them from where you synced it from on your computer and re-sync.
    http://support.apple.com/kb/HT4236

  • Reports with many Dynamic Parameter

    Post Author: Lalit
    CA Forum: Data Connectivity and SQL
    Hi
    I created a report with 5 dynamic parameter in CR XI. There are total 6 SQL command . First one is used for the report purpose and rest is for parameter of the report. There SQL commands are not linked to each other. Performnce of the report is very slow. Data is coming fine on the report. The Command one is returning around 50000 records.
    Paramter are used in record selction to further filter the records
    Please help how i can increase the performance .
    Lalit

    Post Author: yangster
    CA Forum: Data Connectivity and SQL
    eeekwhy don't you create 5 business view objects based on each of your dynamic promptsthis way you can share these parameters in other reports instead of having them all imbedded inside a single reportyou should also be able to schedule the list of values too so they will load faster

  • How can I delete my photos on my Iphone 5 that was sync from my computer? It seems that photos that have been sync from computer is unable to delete on Iphone. Grrr IT *****!

    How can I delete my photos on my Iphone 5 that was sync from my computer? It seems that photos that have been sync from computer is unable to delete on Iphone. Grrr IT *****!

    Photos than came from computer will need to be uncheck on computer then do a sync to delete.
    You can only delete photos from your Camera Roll directly.

  • Using Mail under iOS 5 Mail continues to suggest addresses that have been removed from Contacts. How do I remove old adreesses?

    Using Mail under iOS, 5 Mail continues to suggest addresses that have been removed from Contacts. How do I remove old, obsolete adreesses no longer in Contacts?

    If you open Mail and then in its File menu at the top, click on Window and choose Previous Recipients, you'll get a popup window listing them. At that point, you can highlight and delete any/all.

  • Is there any way to recover photos that have been deleted from my phone?

    im looking to recover photos that have been delted from my iphone 4. is it possible?

    Welcome to the Apple community.
    If you have a backup that includes these photos, you could restore your phone.

  • How can I delete albums from my Ipad that have been copied from my PC?

    How can I delete photo albums from my Ipad that have been copied from my laptop?

    To delete photos from your device
    In iTunes, select the device icon in the Devices list on the left. Click the Photos tab in the resulting window.
    Choose "Sync photos from."
    On a Mac, choose iPhoto or Aperture from the pop-up menu.
    On a Windows PC, choose Photoshop Album or Photoshop Elements from the pop-up menu.
    Choose "Selected albums" and deselect the albums or collections you want to delete.
    Click Apply.

  • How do i retrieve photos that have been deleted from my ipod touch if i have windows operating system?

    how do i retrieve photos that have been deleted from my ipod touch if i have windows operating system?

    Yest it will restore photos deleted from yur iOd probvide that the photos were taken before the the last synce/backyp was made.  Make syre yu have automatic syncing turned off (Itunes>Preference>Devices>Check the box that says prevent auto syncing when connected).  Otherwise when connected, a backup that reflects the deleted photos will be made and will replace the previous backup.

Maybe you are looking for

  • Image capture won't scan some of "detect separate image"

    When put multiple photos on my scanner using "detect separate images, Image Capture recognizes each separate photo, but when it scans, some of the images come out black, and i have to rescan them. Any ideas?

  • Buttons no longer go to highlight state when linked

    I have many simple text buttons that start in white, go to green when rolled over and go to red when pressed. simple stuff. For some reason when I linked the buttons to a url or file the highlight states no longer work. The buttons go to there respec

  • How can I stop the buffering.

    I am trying to watch tv channels over the internet and the image continues to buffer. I have tried a re-set by holding down the wake, sleep button yet it continues. How can I stop this occurring

  • My ipad 1 keeps crashing when in some aps

    Just started having this problem, crashes when using some apps.  Very annoying.

  • Tutorial Xcelsius 2008

    Olá a todos. Preciso de ajudar em relação ao Xcelsius 2008. Sou iniciante na utilização desse aplicativo e precisava de algumas informações. Como faço para configurar a conexão de xml, flash ou Excel. Eu ja li um pouco no manual tanto em inglês e esp