Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Resue Report Objects (Using Access 2000 (9.0.4402) SR-1)

    I have a report with hard coded Record Source and Order By, how can I call that same report with an adhoc Criteria Form with a different Record Source and Order By and still preserve the original
    Record Source and Order By?

    Trying to reuse as many objects as possible.

    Understand the concept, however new to VBA, can you point me to any examples/syntax which illustrate how to work with proper code for my situation.

    Thanks, John Graves

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Resue Report Objects (Using Access 2000 (9.0.4402) SR-1)

    There are a couple of issues here. You can use an Ad Hoc frontend form to change the selection criteria for any report, without having to change the report. Merely specify the selection criteria when you issue your OpenReport command in code. If you create an OpenReport button using the wizard, it will have a strCriteria field; just make it be what you want it to be.

    You can change the recordsource and OrderBy in code in the report's open event. However, you just be careful that the fields of your new recordsource have the same names as the previous one. Remember, your textboxes on the report are bound to a field name, if that field name is no longer there, you will get an error. Also, depending on the report, you may have group/sort sequences set. Will these still be relevant with new recordsource?
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Resue Report Objects (Using Access 2000 (9.0.4402) SR-1)

    This sample db from rogers access library may give you an insight. I used it to make a much simpler form of my own.

    <A target="_blank" HREF=http://www.rogersaccesslibrary.com/download.asp?SampleName='CreateQueries3.mdb'>Sampl e</A>

Posting Permissions

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