Results 1 to 7 of 7
  1. #1
    jlclark4 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Dec 2010
    Location
    North Carolina
    Posts
    155

    On Open to certain record

    I designed several reports for a tabbed form. In each tab I added a command button to preview the report for that tab to be printed (there are no querys being use). What VB would I use for the Command button to have it open to the current record so the user does not have to use the navigation buttons to find the correct report entry. I have two fields in both the report and form that could be linked (EntryNumber) if that helps...

    Thnks!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Sounds like this type of thing:

    BaldyWeb wherecondition
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    jlclark4 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Dec 2010
    Location
    North Carolina
    Posts
    155
    That did solve it. Thank you! How can I get it to open to preview instead of printing it right away?

    Code:
    Private Sub Command939_Click()
    On Error GoTo Err_Command939_Click
    Dim stDocName As String
    stDocName = "rptCDSCursoryReview3"
    DoCmd.OpenReport "rptCDSCursoryReview3", , , "EntryNumber = " & Me.EntryNumber
     
    Exit_Command939_Click:
    Exit Sub
    Err_Command939_Click:
    MsgBox Err.Description
    Resume Exit_Command939_Click
     
    End Sub

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    If you look in VBA help at OpenReport, you'll see the appropriate argument. You haven't specified it, and the default if unspecified is to print.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    jlclark4 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Dec 2010
    Location
    North Carolina
    Posts
    155
    I know the VB for it but I did not know where to place it...

    Code:
    DoCmd.OpenReport stDocName, acPreview

  6. #6
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    DoCmd.OpenReport "rptCDSCursoryReview3",acPreview , , "EntryNumber = " & Me.EntryNumber

  7. #7
    jlclark4 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Dec 2010
    Location
    North Carolina
    Posts
    155
    Thank you

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

Similar Threads

  1. Replies: 1
    Last Post: 11-30-2010, 10:05 AM
  2. Open form which creates new record
    By mjhopler in forum Forms
    Replies: 7
    Last Post: 02-09-2010, 01:37 PM
  3. Open form to current record
    By rbpd5015 in forum Access
    Replies: 1
    Last Post: 08-28-2009, 01:53 AM
  4. Replies: 1
    Last Post: 05-16-2009, 08:47 AM
  5. Replies: 4
    Last Post: 03-24-2009, 09:07 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