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

    Unanswered: Help with printing data to report


    I was wondering if anyone might be able to help me here. I have two tables, staff_table and salary_table.

    Staff_table has the following fields,
    Staff_ID, Staff_FN, Staff_LN,...

    Salary_table has the following fields,
    Sal_ID, Staff_ID, Sal_Date, Pay_Amt,...

    In the salary form, i have a listbox that shows records of the joining of the two tables, because i'd like to be able to show the FirstName and LastName of staff. So Staff_table is joined to Salary_table via Staff_ID.

    And also, in the form, i have a button to print out whatever's listed out in the listbox. It also has a combobox that is to filter the records by Staff_ID.

    The salary report is created using the query named QSalary. QSalary is as a result of the joining of the two tables, Staff and Salary.

    I hope i haven't lost you this far.

    What doesn't work is when i filter by the Staff_ID of 10(michael), i can see there are a few number of records shown just for michael and i want to have them printed out on the report but it doesn't work. it shows the whole records in the salary table.

    Here is my code

    nlist = Me.LB_Salarylist.ListCount

    For ncount = 0 To nlist - 1
    stlinkcriteria = ",'" & Me.LB_Salarylist.ItemData(ncount) & "'" & stlinkcriteria
    Next ncount

    If Len(stlinkcriteria) > 0 Then
    stlinkcriteria = "[QSalary.Sal_ID] In (" & Mid(stlinkcriteria, 2) & ")"
    ' i have tried [Sal_ID] and [Salary_table.Sal_ID], none of them work.
    End If

    stDocName = "Salary_SumReport" ' for producing salary summary report

    DoCmd.OpenReport stDocName, acPreview

    Your help is greatly appreciated.

    Thank you in advance

  2. #2
    Join Date
    Feb 2004
    Could you upload a sample database with the only the relevant objects concerning this function, with some sample data?

Posting Permissions

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