Results 1 to 4 of 4
  1. #1
    waqas is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    117

    Question Dcount Error

    Dear Experts.

    i have two tables in master tables all employees and in detail table worked employees data by date. i am counting shift wise quantity from detali table but i want to count how many employees are existing in particluar group from master i wrote dcount function which is giving error

    kindly chech where i am wrong.

    SELECT UpDateShiftReport.Terminal,
    DCount("[Empno]","RostimaList","[RoleGroup] = " & [Group]) AS HC, UpDateShiftReport.Group,
    Sum(IIf([TandARoster]="07:00-18:00" And [MNM]="M" And [eqpassign]<>'Pooled' And [category]<>'Trng',1,0)) AS [0700-1800-M],
    Sum(IIf([TandARoster]="07:00-22:00" And [MNM]="M" And [eqpassign]<>'Pooled' And [category]<>'Trng',1,0)) AS [0700-2200-M],
    Sum(IIf([TandARoster]="11:00-22:00" And [MNM]="M" And [eqpassign]<>'Pooled' And [category]<>'Trng',1,0)) AS [1100-2200-M],
    Sum(IIf([TandARoster]="18:00-07:00" And [MNM]="M" And [eqpassign]<>'Pooled' And [category]<>'Trng',1,0)) AS [1800-0700-M],
    Sum(IIf([TandARoster]="22:00-07:00" And [MNM]="M" And [eqpassign]<>'Pooled' And [category]<>'Trng',1,0)) AS [2200-0700-M],


    Sum(IIf([TandARoster]="07:00-18:00" And [MNM]="NM" And [eqpassign]<>'Pooled' And [category]<>'Trng',1,0)) AS [0700-1800-NM],
    Sum(IIf([TandARoster]="07:00-22:00" And [MNM]="NM" And [eqpassign]<>'Pooled' And [category]<>'Trng',1,0)) AS [0700-2200-NM],
    Sum(IIf([TandARoster]="11:00-22:00" And [MNM]="NM" And [eqpassign]<>'Pooled' And [category]<>'Trng',1,0)) AS [1100-2200-NM],
    Sum(IIf([TandARoster]="18:00-07:00" And [MNM]="NM" And [eqpassign]<>'Pooled' And [category]<>'Trng',1,0)) AS [1800-0700-NM],
    Sum(IIf([TandARoster]="22:00-07:00" And [MNM]="NM" And [eqpassign]<>'Pooled' And [category]<>'Trng',1,0)) AS [2200-0700-NM],
    Sum(IIf([AMPM]='AM' And [MNM]="NM" And [eqpassign]<>'Pooled' And [category]='Trng',1,0)) AS TrainingNM,
    Sum(IIf([AMPM]='AM' And [MNM]="M" And [eqpassign]<>'Pooled' And [category]='Trng',1,0)) AS TrainingM,
    Sum(IIf([AMPM]='AM' And [MNM]="M" And [eqpassign]='Pooled' And [category]<>'Trng',1,0)) AS PooledMAM,
    Sum(IIf([AMPM]='AM' And [MNM]="NM" And [eqpassign]='Pooled' And [category]<>'Trng',1,0)) AS PooledNMAM,
    Sum(IIf([AMPM]='PM' And [MNM]="M" And [eqpassign]='Pooled' And [category]<>'Trng',1,0)) AS PooledMPM,
    Sum(IIf([AMPM]='PM' And [MNM]="NM" And [eqpassign]='Pooled' And [category]<>'Trng',1,0)) AS PooledNMPM
    FROM RostimaList LEFT JOIN UpDateShiftReport ON RostimaList.EmpNo = UpDateShiftReport.EmployeeNumber
    GROUP BY UpDateShiftReport.Terminal, UpDateShiftReport.Group, UpDateShiftReport.RosterDate
    HAVING (((UpDateShiftReport.Group)<>'-') AND ((UpDateShiftReport.RosterDate) Between #7/24/2012# And #7/24/2012#))
    ORDER BY UpDateShiftReport.Terminal, UpDateShiftReport.RosterDate;
    Attached Files Attached Files

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    I cant look at the sample right now. What's the data type of Group? If text:

    http://access.mvps.org/access/general/gen0018.htm

    Since the table is in the query, why not just list the field?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    waqas is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    117
    Dear Experts,

    i have attached example db in this db i have add two tables. rostimalist is a master table and other updateshiftreport is a detail table.

    in master table all records means all employees are existing in detail table in one day or in one date some employees are worked.

    now i want to count from master tables all employees in each group and from detail how many worked in one day from each group.

    i got count from detail table but i am facing problem counting from master table for this i have put dcount formula in my attached db query but it is giving me error both fields has same datatype as text length 32.

    kindly chech my attached file and send me any solution.

    thanks for your cooperation.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    So you didn't bother to read the link I posted?

    HC: DCount("[Empno]","RostimaList","[RoleGroup] = '" & [Group] & "'")
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. DCount Error
    By drewetzel in forum Access
    Replies: 5
    Last Post: 02-13-2014, 06:57 AM
  2. DCount
    By Ray67 in forum Queries
    Replies: 2
    Last Post: 06-26-2012, 10:48 AM
  3. DCount on a Query giving #Name? error
    By Huddle in forum Access
    Replies: 9
    Last Post: 06-20-2012, 11:40 AM
  4. Replies: 5
    Last Post: 12-15-2011, 11:16 AM
  5. DCount
    By nsteenhaut in forum Queries
    Replies: 2
    Last Post: 10-04-2011, 05:00 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