Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2017

    Unanswered: Output current record to report

    I'm attempting to Output a single record to a report. I think I'm close on the code but I'm just missing the mark. I can get it to bring up the output to menu but after I select the format I get Microsoft Access cannot find the object'|1'
    Here is my code:
    Dim strOriginalRecordSource As String
    Dim strNewRecordSource As String

    strOriginalRecordSource = Me.RecordSource
    strNewRecordSource = "SELECT * FROM CDB WHERE [LAST_NAME] ='" & Me![LAST_NAME] & "'"

    Me.RecordSource = strNewRecordSource
    DoCmd.OutputTo acOutputForm, "ICDP", , False
    Me.RecordSource = strOriginalRecordSource

    If I change the line of code from outputto to the following it works:
    DoCmd.OpenReport "ICDP", acViewPreview, , "[LAST_NAME] = '" & Me![LAST_NAME] & "'" or
    DoCmd.OpenReport "ICDP", acnormal, , "[LAST_NAME] = '" & Me![LAST_NAME] & "'"

    Any assistance would be much appreciated

  2. #2
    Join Date
    Apr 2014
    Provided Answers: 34
    use a form (say myForm). The form has a combo (or listbox) of persons.
    select the person in the list.
    the query (in the report) looks at this list to pull the data; select * from table where [lastname]='" & forms!myForm!cboBox & "'"

    open the report and only that person will show.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts