Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Mar 2002
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    sqlstr (Access 2000)

    I have the following code to create a report.

    sqlstr = "[tblSamples.Product] = Forms![frmMain]![cmbProductCode]"
    DoCmd.OpenReport stDocName, acPreview, , sqlstr

    How can I revise sqlstr to only show the last 14 rows of [tblSamples.Product] = Forms![frmMain]![cmbProductCode].

    Thanks,

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: sqlstr (Access 2000)

    I think you will have to create a query based on tblSamples, with the criteria for Product set to [Forms]![frmMain]![cmbProductCode].
    Sort the query descending on the appropriate field, and set the Top Values property of the query to 14.
    Set the Record Source of the report to the name of the query, and open the report without a WhereCondition argument:

    DoCmd.OpenReport stDocName, acViewPreview

Posting Permissions

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