Results 1 to 4 of 4
  1. #1
    Lounger
    Join Date
    Jan 2002
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Median Calculation (2000)

    I'm trying to calculate a median using the code from post 301021, but keep getting a run time error - type mismatch. Any idea what I'm doing wrong? Thanks.

  2. #2
    Lounger
    Join Date
    Jan 2002
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Median Calculation (2000)

    Never mind - I changed the dim rst as Recordset to dim rst as DAO.Recordset and it fixed the problem.

  3. #3
    New Lounger
    Join Date
    Sep 2004
    Location
    Durham, USA
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Median Calculation (2000)

    i copied the code from post 301021 to run a median calc. my problem is that my recordset field values to apply the median calc to is for 200 different salesmen.

    how would i handle this to calc the median for each in the same recordset.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Median Calculation (2000)

    Welcome to Woody's Lounge.

    You must create a totals query that groups by salesman. Then set up the median like this; you will have to substitute the appropriate names, of course. If you have a numeric identifier SalesmanID for the salesmen:

    M: Median("TableName", "FieldName", "[SalesmanID] = " & [SalesmanID])

    If you use the name of the salesmen (a string):

    M: Median("TableName", "FieldName", "[SalesmanName] = " & Chr(34) & [SalesmanName] & Chr(34))

    The Chr(34) are used to insert quotes in the string. In both cases, set the Total option for this column to Expression.

Posting Permissions

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