Results 1 to 4 of 4

Thread: Access forms

  1. #1
    Join Date
    Mar 2011
    Posts
    4

    Question Unanswered: Access forms

    I have an issue with counting records. In both reports all records and the one filtered by Director, I need to total up the records in the employee info table and have the count available for a calculation in the reports, Takes the total hours and divides by the number of employees. In the filtered form, Director Report Date I would like it to go and tally the records of all the employees for the director chosen in the form each time the report is run so if they add employees the calculation will always be current. The same thing needs to happen for the ALL employee report... count all records and store. Should this be controlled by the form? I have included an updated copy of the mdb.

    Thanks again for your support.
    Attached Files Attached Files

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Create a new module in the database and paste this code into it:
    Code:
    Public Function Get_Employee_Info_RecordCount() 
    
        Get_Employee_Info_RecordCount = DCount("EmployeID", "Employee Info")
        
    End Function
    You can then address this function from everywhere in the code (Forms Class Module, Report Class Module, Query, etc...):
    Code:
    Dim Number_Of_Employees 
    Number_Of_Employees = Get_Employee_Info_RecordCount
    or (in a form):
    Code:
    ' Text_EmployeeCount is a textbox in the form.
    Me.Text_EmployeeCount.Value = Get_Employee_Info_RecordCount
    Have a nice day!

  3. #3
    Join Date
    Mar 2011
    Posts
    4

    Question Counting Records

    Sinndho, thanks for the code. I understand what it is supposed to do, however I am still confused on where I should place it in the control forms. frmDirector Report Date. Sorry for the ignorance with Access, but the last time I did anything in Access was many years ago. Can you insert the code where it belongs in the form? The new object has been created.

    Thanks again for your help.
    Attached Files Attached Files

  4. #4
    Join Date
    Mar 2011
    Posts
    4

    Exclamation Counting up total records

    I have the Associate directors reports working, but not the report that shows all employees. I cannot figure out a way to total up the employees in the Employee Info table and bring that total into the report. Also, there is an issue with the training types duplicating on the report that shows all employees. If there is one employee from each director with the same training type, the report will list it twice instead of a consolidated entry. I have attached the mdb for clarification.

    Thanks.
    Attached Files Attached Files

Posting Permissions

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