Share via

print current record only

Anonymous
2013-01-07T21:39:14+00:00

I'm trying to put a button on a form that will print a copy of a report (named: price tags) for the current record only

Any Ideas

Thanks

Jeff

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

11 answers

Sort by: Most helpful
  1. Anonymous
    2013-01-09T16:56:24+00:00

    It sounds like you have quotes in the wrong places.  Post a Copy/Paste of the code as you tried it.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2013-01-09T14:33:36+00:00

    It asks me to:

    "Enter Parameter Valve"

    for

    Me.number

    ("number" being my primary key field name)

    If I enter a value, it still prints all the records

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2013-01-09T12:55:39+00:00

    I can not get this to work.  Not sure what I'm doing wrong

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2013-01-07T23:13:18+00:00

    One thing I'd add is that you should ensure the form's current record is saved before opening the report.  Otherwise any unsaved changes which might have been made to the record won't be reflected in the report, and if it's a new record nothing will be reported.  Doing it in the button's Click event procedure rather than via a macro the code would be like this:

        Dim strCriteria As String

        strCriteria = "[primary key field name] = " & Me.[primary key field name]

        ' ensure current record is saved

        Me.Dirty = False

        ' print report filtered to current record

        DoCmd.OpenReport "Price Tags", WhereCondition:=strCriteria

    If the key is a column of text data type amend the expression as described by Marshall.

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2013-01-07T22:05:54+00:00

    Use the button wizard to create a  macro to open the report.  Then fiill in the WhereCondition parameter to match the record's primary key field to the form text box to the same field in the table.   It may look vaguely like:

    If the primary key field is a number data type:

       "[primary key field name] = " & Me.[primary key field name]

    if it's a Text field:

       "[primary key field name] = """ & Me.[primary key field name] & """ "

    Was this answer helpful?

    0 comments No comments