Results 1 to 2 of 2
  1. #1
    sofarfromexpert is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    1

    What am I doing wrong? Printing a single report

    I have read this question on this forum several times and even with that being said, I can not figure out why I can not make this VB code to work. Here is my debug error. Please help.

    Private Sub cmdPrintRecord_Click()


    Dim strReportName As String
    Dim strCriteria As String

    strReportName = "rptPrintRecord"
    strCriteria = "[EmployeeID]='" & Me![EmployeeID] & "'"
    DoCmd.OpenReport strReportName, acViewPreview, , strCriteria

    End Sub

    The red text has been identified as my issue?

  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,518
    What is the error? If it highlights that line, it's likely because EmployeeID isn't on the form. If that field is numeric the syntax is off:

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

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

Similar Threads

  1. Printing a single Report from two forms
    By cvolkers in forum Programming
    Replies: 4
    Last Post: 03-06-2011, 11:27 PM
  2. Exporting single query and single report.
    By rfhall50 in forum Programming
    Replies: 2
    Last Post: 02-18-2011, 12:08 PM
  3. Printing a single report from form
    By OFA in forum Forms
    Replies: 9
    Last Post: 06-08-2010, 09:27 AM
  4. Print Single Report
    By emkwan in forum Access
    Replies: 1
    Last Post: 01-29-2010, 11:19 AM
  5. What I am doing wrong? (caption of report)
    By swampdonkey in forum Reports
    Replies: 0
    Last Post: 12-07-2006, 11:07 AM

Tags for this Thread

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