Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Feb 2001
    Location
    Minnesota
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    form to open a report (Access 97)

    I have a form with a studentID, name, etc. I want the form to open a report and only show the information for the student I enter in the form?

  2. #2
    New Lounger
    Join Date
    Nov 2001
    Location
    USA
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: form to open a report (Access 97)

    You need to set a filter to the control source of the report to equal the combo or text field on the form that is the PK for that student.

    I.e.
    =Forms!frmFormName.[StudentID]

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: form to open a report (Access 97)

    Actually, you can open the report directly to that information by passing a WhereCondition string to the report when you open it. It would look something like this:

    <pre>DoCmd.OpenReport "rptStudentInfo", , , "[StudentID]='" & Me!txtStudentID & "'"</pre>


    This command would go in the code behind your form, and I've made some assumptions here: that your report is named rptStudentInfo, that you have a field called StudentID in the recordset of your report, that StudentID is a text field, and that you have a control called txtStudentID on your form. If StudentID is a numeric field, then take out the single quotes.
    Charlotte

Posting Permissions

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