Results 1 to 4 of 4
  1. #1
    teresamichele is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    23

    Report only returns 1 record unless run directly

    I have a report in Access 2007 that returns records based on a product code. Simple enough, right?

    However, I have a form where folks can click "Product Code" and enter the code, let's say 1234, and instead of rptCode coming up with all four entries with that product code, it only returns one.

    That said, if I run the report directly, with the same product code, I get all four entries!

    I'm guessing, then, that it's the coding or something I've messed up that cuts it off at one. I have no idea what, though.

    Any idea what might be causing that?

    Here is the code I'm using "on click" for the button:

    Option Compare Database
    Private Sub Label9_Click()
    On Error GoTo Err_Label9_Click
    Dim stDocName As String
    stDocName = "rptCode"
    DoCmd.OpenReport stDocName, acPreview

    Exit_Label9_Click:
    Exit Sub

    Err_Label9_Click:
    MsgBox Err.Description
    Resume Exit_Label9_Click

    End Sub

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    whats the recordsource of the report? there is nothing wrong with the code

  3. #3
    teresamichele is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    23
    The record source is:

    SELECT ProjectEntry.Number, ProjectEntry.Requestor, ProjectEntry.Product, ProjectEntry.Code, ProjectEntry.Test, ProjectEntry.Details, ProjectEntry.[Date Logged], ProjectEntry.[Date Due], ProjectEntry.Status, ProjectEntry.Person, ProjectEntry.[End Date], ProjectEntry.Priority, ProjectEntry.[Kronos], ProjectEntry.[Start Date]

    FROM ProjectEntry

    WHERE (((ProjectEntry.Code)=[Enter Product Code]));

    Like I said before, though, it works fine if I just click on it from the list of objects, but if I run it from the button on the form, it stops at one record. I'm quite confused!

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    PMFJI but you can get different results for Preview vs. Printing. I know it is a waste of paper but do you get the same results when printing from the form? I prefer to provide the Control on the form for the Criteria rather than forcing the query to ask the question and then use the WhereClause argument of the OpenReport command to apply the Criteria. Just my $0.02

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 08-13-2010, 10:10 PM
  2. Replies: 11
    Last Post: 07-20-2010, 06:55 AM
  3. Why 2 users cant open an access file directly???
    By finnegan bell in forum Access
    Replies: 6
    Last Post: 03-22-2009, 09:06 PM
  4. Replies: 1
    Last Post: 02-02-2009, 05:52 AM
  5. SENDING EMAIL MESSAGES DIRECTLY FROM ACCESS
    By Frenchos in forum Access
    Replies: 0
    Last Post: 07-20-2007, 12:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums