General discussion

  • Creator
    Topic
  • #2130445

    Access Reports and Forms

    Locked

    by paulalexander ·

    How can I print one record using a pre-defined report from a button I’ve created on a form. The record I want is shown on the report. Access Help gives an answewr, but it doesn’t matter how many times I try it don’t work !! (You know [fieldname]= FORMS![formname]![fieldname] )

    Is there something missing ?

All Comments

  • Author
    Replies
    • #3547320

      Access Reports and Forms

      by duppypog ·

      In reply to Access Reports and Forms

      Your form should have a field that uniquely identifies that record. In the underlying query for the report, the parameter criteria should point to that field – like this:
      [Forms]![frmMyFormName]![txtFieldname]
      This tells the query to get the parameter from the form field to return that specific record.
      Your button on the form just needs to either print preview the report, or print it.

      Hope this helps-
      Lynnette

    • #3549611

      Access Reports and Forms

      by john_wills ·

      In reply to Access Reports and Forms

      The previous answer should work, but I don’t like it because it insists that the nested program(the report in this case) know what is nesting it, very unmodular. The structure I use for this kind of work is this:
      Private Sub PrintClientInformation_Click()
      DoCmd.OpenReport “rptClientInformation”, acPreview, , “[ClientID]=” & Me.ClientID
      End Sub
      However, there may well be, as you suggest, something missing from your call, dependent perhaps on something in your form, although I cannot think what.

    • #3438182

      Access Reports and Forms

      by paulalexander ·

      In reply to Access Reports and Forms

      This question was auto closed due to inactivity

Viewing 2 reply threads