Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Location
    Newbury, UK
    Posts
    7

    Cool Unanswered: Reports from SubForm

    Hi all,

    The answer to this is probably really simple, but I can't work it out!

    I have a main form (Student) which has a sub form (Enrolments).

    On the sub form I have a combo box (StudentStatus) with 'Active', 'Withdrawn', 'Completed' and 'Non-starter'. When the status is changed to anything other than Active it prints a report. However, when the report is printed, it prints 1 report for every record in the subform. I only want to print the one report for the current record I am on.

    Any Ideas?

    Many Thanks in Advance.

    Martyn

  2. #2
    Join Date
    Sep 2003
    Posts
    83
    what is the code that you have used for printing?

  3. #3
    Join Date
    Feb 2004
    Location
    Newbury, UK
    Posts
    7
    Hi,

    The Code is:

    Sub LD_Status_AfterUpdate()

    Select Case LD_Status

    Case Is <> "Active"

    Select Case MsgBox("Would you like to Print an Amendment Form?", vbQuestion + vbYesNo, "Print Report")

    Case vbYes

    DoCmd.OpenReport "LDAmendmentForm", acViewPreview

    End Select
    End Select
    End Sub

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi

    If you start the procedure with:

    dim strKeyValue as string '(or integer or whatever the key value for the record is)
    dim strWhere as string

    'then add:
    strKeyValue = me.txtKeyTextBox

    strwhere = "[KeyField] = '" & strKeyValue & "'"

    'then change the docmd to

    DoCmd.OpenReport "LDAmendmentForm", acViewPreview, , strWhere

    I think that should work. Obviously it depends on how many field values you need to read to ensure you are picking up a unique record. Hope this helps

Posting Permissions

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