Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2004
    Location
    Edmonton, Canada
    Posts
    72

    Unanswered: .ADP Report RecordSource = storedProc & DateParameter

    I can't get my Access 2000 .ADP report to work with a parameter. The parameter is the report date.

    I always get the error: The recordsource specified does not exist

    When the user clicks the print button, I take the date off a form and put it into a global variable theDt, on the report's OnOpen event:

    Private Sub Report_Open(Cancel As Integer)
    Me.RecordSource = "EXEC proc_MySP '" & theDt & "'"
    End Sub

    I always get the error: The recordsource specified does not exist

    You can't change the report's recordsource until it's open, that's why I put the assignment in the OnOpen event. With forms, it works fine, because the form is open when you assign the RecordSource property.

    When I save the RecordSource property, instead of trying to set it in code, it works fine, once I supply the date parameter.

  2. #2
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    441
    I use rather similar syntax in later versions without problems, but I don't know the 2000 version ADP's. You are sure you have an SP called proc_MySP taking a date parameter?

    What about owner prefix?

    Me.RecordSource = "EXEC dbo.proc_MySP '" & theDt & "'"
    Roy-Vidar

  3. #3
    Join Date
    Jul 2004
    Location
    Edmonton, Canada
    Posts
    72
    Ya, the proc exists, it's the same one I use to populate the form. I've tried putting the owner prefix in, and it didn't help either.
    Thanks

  4. #4
    Join Date
    Jul 2004
    Location
    Edmonton, Canada
    Posts
    72
    I just tried using the InputParameters property of the report

    Me.InputParameters = "@spDt = '" & Format(glblMyDt, "yyyy/mm/dd") & "'"

    The procedure still prompts me for spDt

    When I hardcode @spDt = '2005/12'27' it works fine, just doesn't like thedynamic runtime assignments??

  5. #5
    Join Date
    Jul 2004
    Location
    Edmonton, Canada
    Posts
    72
    Got It!

    Don't do it in code, bind the report's property directly to the control on the form

    Copied right from the property sheet:

    @spDt = Forms![frmMyMainForm]!subfrmMyChildForm.Form.cboTheDate

    Carl

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •