Results 1 to 3 of 3

Thread: Blank Report???

  1. #1
    Lounger
    Join Date
    Sep 2005
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have a form that users enter data. If a particular field turns red then a print button shows up. This works fine. I want the print button to open a report and print the current record.
    All i am printing is a blank record. Here is the code for the print button:

    Private Sub PrintCurrentEntry_Click()
    On Error GoTo Err_PrintCurrentEntry_Click

    Dim StrCriterion As String
    Dim stDocName As String

    StrCriterion = "[ID]=" & Me![ID]
    DoCmd.OpenReport "Screen Print of Data Entry Tracking", acNormal, , StrCriterion



    Exit_PrintCurrentEntry_Click:
    Exit Sub

    Err_PrintCurrentEntry_Click:
    MsgBox Err.Description
    Resume Exit_PrintCurrentEntry_Click

    End Sub


    I can debug while i run the code and it looks like it gets the right ID.

    On my report my recordsource is a query with this in the ID field -

    [Forms]![Mainscreen menu]![ID]

    Mainscreen menu is the name of the form where information is entered.

    Why is it printing nothing - what am i missing?

    Appreciate any help - thanks!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    There's no need to use both a WhereCondition argument in DoCmd.OpenReport AND a condition in the record source of the report.
    If you prefer to specify the WhereCondition argument, remove the condition from the query.
    If you prefer to specify the condition in the query, omit the WhereCondition argument from DoCmd.OpenReport.

  3. #3
    Lounger
    Join Date
    Sep 2005
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you! I though i had taken one or the other out before and tried it - must not have saved properly when i did it - all is working now. Thank you!

Posting Permissions

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