Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Mar 2003
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Print Record (1)

    I have a form which contains a sub-form. This subform can contain multiple records. The subform contains a Print Records button. I have two setups similar to this. For the one, if there are multiple records and I click "print" for the second, third... it insists on only printing the first record (note: I highlight the > frame to the left of the form). For the other (form), it seems to print *all* records when I choose a record other than the first.

    I read the earlier threads concerning this and confirmed that my code includes the "selection" command:
    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.PrintOut acSelection.

    Also, I read Hans' recommendation to only print reports. The client specifically wants to be able to print out of the entry windows, so, unfortunately, that is not an option.

    Question/request: is there any other way to ensure that only the record on the screen is printed?

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Print Record (1)

    You can use the OpenReport command with a criteria to print the current selection.
    Pat

  3. #3
    New Lounger
    Join Date
    Mar 2003
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print Record (1)

    Can you elaborate a little more? Are you recommending that I add an additional line:
    DoCmd.OpenReport aSelection...

    before the print code? I did try that - but same results.

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Print Record (1)

    What I am suggesting is that you replace both the lines you have with one that runs a report. The command from Access help is:
    DoCmd.OpenReport reportname[, view][, filtername][, wherecondition]
    The where condition would be one that identifies the current record of the form, eg.
    DoCmd.OpenReport "yourreportname", acViewNormal, , "RecordID=" & lngRecordID

    You will have to substitute your names for the report, fields from the query of the report and the field(s) from the current record of the form.

    Pat

  5. #5
    New Lounger
    Join Date
    Mar 2003
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print Record (1)

    Pat, apologies for not responding sooner. This certainly did the trick and I appreciate your assistance.

Posting Permissions

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