Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Printing Problems

Discussion in 'Information Technology' started by Geoff, Jul 28, 2006.

  1. Geoff

    Geoff
    Expand Collapse
    Guest

    I am printing out from a Form and request printing of Selected Record. The
    first record prints OK but then the second record each time shows an error
    with Access closing down
     
  2. Loading...

    Similar Threads Forum Date
    Controversial War over Private Printing of "Birs" Intensifies Hard Talk Jul 9, 2011
    Sikh News Sikhs Face Problems While Carrying Kirpans In Khyber-Pakhtunkhwa - SikhSiyasat.Net Breaking News Jul 29, 2016
    "Dasam" Granth - A Look At The Core Problems Dasam Granth Oct 21, 2015
    Problems In Life Sikh Sikhi Sikhism Apr 13, 2015
    Muslim Girl-Sikh Boy Marriage Problems- Please Help! Love & Marriage Oct 12, 2012

  3. Rick B

    Rick B
    Expand Collapse
    Guest

    Not sure what you mean. If you have one record on a form, and you wish to
    print a report that only contains that record, what do you mean by "the
    second record..."? I thought you were only printing the current record?

    Here is an example of what your code should look like...

    Private Sub cmdPrint_Click()

    Dim strWhere As String

    If Me.Dirty Then 'Save any edits.

    Me.Dirty = False

    End If

    If Me.NewRecord Then 'Check there is a record to print

    MsgBox "Select a record to print"

    Else

    strWhere = "[ID] = " & Me.[ID]

    DoCmd.OpenReport "MyReport", acViewPreview, , strWhere

    End If

    End Sub



    Notes: If your primary key is a Text type field (not a Number type field),
    you need extra quotes: strWhere = "[ID] = """ & Me.[ID] & """"

    If you want the report to print without preview, replace acViewPreview with
    acViewNormal.



    See also: http://allenbrowne.com/casu-15.html




    --
    Rick B



    "Geoff" <Geoff@discussions.microsoft.com> wrote in message
    news:E4096926-0AC4-41CA-B2D4-8CC2C30B0B15@microsoft.com...
    >I am printing out from a Form and request printing of Selected Record. The
    > first record prints OK but then the second record each time shows an error
    > with Access closing down
     

Share This Page