Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2010
    Posts
    85
    Provided Answers: 2

    Red face Answered: Slightly embarrasing question

    Hi all

    I have done this in the past but can't remember how, or locate my old DB.

    Using Access 2003 I have a form (LastServiceBetweenDates) that accepts a StartDate, EndDate, State (list box) and Region (list box) The idea being that a report is generated and previewed showing results between the StartDate and EndDate when a command button is clicked to run the report.

    I have the query (LastServiceBetweenDates) that works fine when run on its own.

    The ServiceDate criteria looks like this;
    Between [Forms]![LastServiceBetweenDates]![StartDate] And [Forms]![LastServiceBetweenDates]![EndtDate]

    The Region criteria looks like this;
    [Forms]![LastServiceBetweenDates]![Region]

    and the State region looks like this;
    [Forms]![LastServiceBetweenDates]![State]

    I have the report (Last Service Between Dates) that works fine when run on its own.

    When I run the form to produce the report the report generates but with no data. I've stared at this now for longer than should be necessary and can't see what I'm missing. Here is the code behind the form

    Code:
    Private Sub Preview_Click()
    On Error GoTo Err_Preview_Click
    
        Dim stDocName As String
        Dim stLinkCriteria As String
        
        stDocName = "Last Service Between Dates"
        DoCmd.OpenReport stDocName, acPreview, stLinkCriteria
    
    Exit_Preview_Click:
        Exit Sub
    
    Err_Preview_Click:
        MsgBox Err.Description
        Resume Exit_Preview_Click
        
    End Sub
    The format for StartDate and EndDate are Shortdate.

    Like I said, I'm embarrassed to ask for help but frankly it's driving me batty.

    Any help would be greatly appreciated.

  2. Best Answer
    Posted by healdem

    "EndtDate or EndDate?

    Display the values of the input parameters in the report to prove they are sane. Generally I akways do this when a report ses a subset of data. If needs be set up a display message in the nodata event.

    Demonstrate there is data for the specified filters

    You can stuff the parameters into the strlinkcriteria of the openreport macro"


  3. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    EndtDate or EndDate?

    Display the values of the input parameters in the report to prove they are sane. Generally I akways do this when a report ses a subset of data. If needs be set up a display message in the nodata event.

    Demonstrate there is data for the specified filters

    You can stuff the parameters into the strlinkcriteria of the openreport macro
    I'd rather be riding on the Tiger 800 or the Norton

  4. #3
    Join Date
    Sep 2010
    Posts
    85
    Provided Answers: 2
    OK. I give up. No more late nights and coffee.

    Than you again Healdem. Sometimes some clear eyes see where blurry one won't.

    That wsa of curse the probmel.

Posting Permissions

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