Results 1 to 3 of 3
  1. #1
    Hillary is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    2

    Report preview from sub form

    I have a sub form (CURRENT BY CASE) at the bottom of my MAIN form(NCP/CP AUDIT). I would like to do this.

    Preview on screen a report (
    CURRENT BY CASE RPT) of the subform data the record
    currently displayed in the main form

    Here is the code I have attempted to use unsuccessfully to view
    CURRENT BY CASE RPT:

    Private Sub Command22_Click()

    On Error GoTo Err_Command22_Click

    Dim stDocName As String

    stDocName = "CURRENT BY CASE"
    DoCmd.OpenReport stDocName, acPreview, , "ID_CASE= forms! [NCP/CP AUDIT TBL]! ID_CASE"

    Exit_Command22_Click:
    Exit Sub

    Err_Command22_Click:


    MsgBox Err.Description
    Resume Exit_Command22_Click

    End Sub
    I currently am getting a syntax error—“Invalid use of ‘.’,’!’,or ‘()’. In query expression ‘(ID_CASE=forms![NCP/CP AUDIT TBL]!ID_CASE)’


    Attached is a screen shot of the Main and Sub Form


    Thanks for the help

  2. #2
    Hillary is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    2
    I figured it out! Thanks anyway

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Would you care to share your solution with the others that read this forum?

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

Similar Threads

  1. Print Preview different from Print Hardcopy
    By peterc in forum Reports
    Replies: 4
    Last Post: 10-27-2009, 05:35 AM
  2. Replies: 6
    Last Post: 09-26-2009, 07:17 AM
  3. Error when trying to print or print preview
    By TriAdX in forum Reports
    Replies: 8
    Last Post: 08-25-2009, 08:20 AM
  4. Replies: 1
    Last Post: 03-02-2009, 11:54 AM
  5. Replies: 1
    Last Post: 04-05-2006, 01:58 PM

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