Printing a single record

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Steve Eccles
    New Member
    • Jun 2008
    • 1

    #1

    Printing a single record

    I'm trying to print out only the current record from my form in a report but each time all the records print out. How can I print only one record using a report.

    I have place a button in the report, with the following in the command in the On Click box;

    DoCmd.OpenRepor t "Issues",acView Preview, , "[ID] = " & Me![ID]

    Each time I try to run this I get the following message;

    Access cannot find the object DoCmd.

    Where am I going wrong?

    Steve
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    Hi Steve. There is nothing at all wrong with your attempt to open the report using the specified ID filter. I am assuming that it was a typo when you say you placed a command button on the report - you surely meant a selection form of some kind? (It would make no sense at all to have a command button opening the report on the report itself...)

    Assuming as mentioned that your command button is on a form, the ominous problem is the lack of recognition of the DoCmd, which is an essential part of VBA for Access. Is this not recognised throughout your application, or only with this one form? If the problem is limited to the one form, could you post the code in which your DoCmd is placed, so we can check it for you?

    If DoCmd is not recognised at all it sounds like a problem with missing project references - the DLL libraries that your code uses - though I can think of no explanation for it at present. To check your references, in the VBA code window select Tools, References. I attach a screenshot of the references for one of my databases so you can see what to look for.

    -Stewart
    Attached Files

    Comment

    Working...