Results 1 to 2 of 2
  1. #1
    Kristi.owen091010 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    5

    Printing Single Record from subform or filtering and bringing up a report

    Hello! I have a Main form with a subform attached. I have a few unbound text boxes in that subform so people can type in and print information on the form. However I can not get it to print the subform. I also need it to print that single record. I built a report as suggest, but I still cannot get my command button show me just that one record associated with that subform. Here is the code I am using:



    Private Sub Command175_Click()
    Dim strWhere As String
    If Me.Dirty Then 'Save any edits.
    Me.Dirty = False
    End If
    If Me.NewRecord Then 'Check there is a record to print
    MsgBox "Select a record to print"
    Else
    strWhere = "[Repetitive # or Name assigned] = """ & Me.[ Repetitive # or Name assigned] & """"
    DoCmd.OpenReport "Repetitive Listing", acViewPreview, , strWhere
    End If
    End Sub


    When I click the button it say it does not recognize [Repetitive # or Name assigned].

    Any suggestions??

  2. #2
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    First off, is Repetitive # a number or text. Note Should not have spaces or use Alfa-characters in field names.
    I assume Name assigned is text.

    I don't think you can put and OR in the 2nd part of your WHERE clause.

    Since field names have a space the [Names assigned] is how they are referenced.

    In other words. strWhere is wrong.

    Usually I print a report from a underlying query for the report.
    A little more information about your form, report and queries.
    Or upload your database.

    Dale

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

Similar Threads

  1. Printing a single record in a report
    By kelann in forum Reports
    Replies: 28
    Last Post: 10-04-2012, 10:07 AM
  2. What am I doing wrong? Printing a single report
    By sofarfromexpert in forum Reports
    Replies: 1
    Last Post: 07-15-2012, 07:33 PM
  3. Printing a single Report from two forms
    By cvolkers in forum Programming
    Replies: 4
    Last Post: 03-06-2011, 11:27 PM
  4. Replies: 2
    Last Post: 08-20-2010, 04:50 AM
  5. Printing a single report from form
    By OFA in forum Forms
    Replies: 9
    Last Post: 06-08-2010, 09:27 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