Results 1 to 4 of 4
  1. #1
    kris335 is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2011
    Posts
    23

    Report asking for parameters when printing

    Hiya. I'm trying to get a report to print out from a certain form and print just the info in the form that is onscreen. It's working EXCEPT I'm getting a pop-up when I click the print button where it asks for paremeters.

    Here is my code attached to my button:

    Private Sub cmdPrint_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 = "[Child ID] = " & Me.[Child ID]
    DoCmd.OpenReport "Child Card Print", acViewNormal, , strWhere
    End If
    End Sub

    I'm using my field of "Child ID" instead of my primary key since that's hidden. But when I click the print button, it keeps asking me for the Child ID I want to print. I just want it to print the Child ID of the form that is currently open!

    What am I missing here?!



    Thanks so much for the help!

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    If [Child ID] is a string value then you will need:
    strWhere = "[Child ID] = '" & Me.[Child ID] & "'"

  3. #3
    kris335 is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2011
    Posts
    23
    [Child ID] is a 3-digit number field.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Is the RecordSource of the Report generic and simply ask for all records? If not then it is probably the RecordSource query that is requesting the parameter and not the report.

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

Similar Threads

  1. Form to supply parameters to a report
    By Ray67 in forum Reports
    Replies: 11
    Last Post: 07-22-2011, 02:06 PM
  2. Access Report Keeps Asking for Parameters
    By italianfinancier in forum Reports
    Replies: 1
    Last Post: 06-07-2011, 12:04 PM
  3. Report parameters
    By saylindara in forum Reports
    Replies: 15
    Last Post: 08-02-2009, 03:49 PM
  4. Passing parameters to a report
    By elmousa68 in forum Access
    Replies: 0
    Last Post: 12-07-2006, 01:38 AM
  5. DISPLAY INPUT PARAMETERS ON THE REPORT
    By fadone in forum Forms
    Replies: 1
    Last Post: 12-09-2005, 10:26 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