Results 1 to 2 of 2
  1. #1
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Print Direct (2003)

    How do I print a report from a form for the current record open. At the moment a button is pressed, and a query will ask for the Serial number. I have been asked for it print the current record.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 18 Times in 18 Posts

    Re: Print Direct (2003)

    Does the record source of the form have a field that uniquely identifies the record? Let's say it is named ID and that it is a number field.
    You can then use code like this:

    Private Sub cmdReport_Click()
    DoCmd.OpenReport ReportName:="rptMyReport", WhereCondition:="ID=" & Me.ID
    End Sub

    If the ID field is a text field, change the above to

    ..., WhereCondition:="ID=" & Chr(34) & Me.ID & Chr(34)

    and if it is a date field, to

    ..., WhereCondition:="ID=#" & Format(Me.ID, "mm/dd/yyyy") & "#"

Posting Permissions

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