Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2011
    Posts
    2

    Unanswered: Printing a report from a form

    Hi,

    I am trying to get access to print an ID Card.

    I've created a report which is the ID Card and that works fine, what I want to do is place a button on the employees form which will print the individuals ID card. I created the button on the form which is set to print the report but it is obviously printing the whole report (every ID card for every employee) I need to to filter so it only prints the ID card for the form I am looking at!

    Is this possible?

    Many thanks for any help.

  2. #2
    Join Date
    Jun 2011
    Location
    Inside your mind
    Posts
    297
    Yup, that's possible.

    Do you want it to actually print, or just open the report ready for printing?
    Looking for the perfect beer...

  3. #3
    Join Date
    Jun 2011
    Location
    Inside your mind
    Posts
    297
    Code:
    DoCmd.OpenReport "YourIDReportName", acPreview, , "[YOUR ID FIELD NAME] = " & Me.whateverYourIDFieldNameFieldIs.Value
    Where:

    YOUR ID FIELD NAME - Is the name of the field on your table that is used as your primary key
    whateverYourIDFieldNameFieldIs - Is the name of the field on the form itself, that tells you what ID you are currently on

    On the button should do the trick.


    Note: This assumes you are using a numeric primary key (ID), and also, that you are using an ID... If you aren't you will have to extract more details from the form page you're on, and increase the where statement in the DoCmd method.
    Last edited by kez1304; 08-26-11 at 12:25.
    Looking for the perfect beer...

  4. #4
    Join Date
    Aug 2011
    Posts
    2

    Thanks

    Hi,

    Thanks for the reply, I am a complete dummy with Access - coudl you explain how to use the script? I have never used Macros or VBA!

    I knwo I shouldn't be trying advanced stuff without some experiance but I didn't think this was going to be difficult!

    Cheers

    Ian

Tags for this Thread

Posting Permissions

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