1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

MS Access Expression Help!

Discussion in 'Business Applications' started by Sonny100, Jul 10, 2006.

Thread Status:
Not open for further replies.
Advertisement
  1. Sonny100

    Sonny100 Thread Starter

    Joined:
    Jul 10, 2006
    Messages:
    8
    Afternoon all,

    I am trying to write an expression in Access, but i'm having a little trouble!

    Basically, I'm searching a table for all entries that match the current records Primary Key, the field that the expression is in then displays the number of entries.

    I currently have...... =DCount("*","Date table","[Analyst] =

    I just need to know what to put at the end, the "[Analyst] =" part must equal the primary key of what ever record it's in at the time.

    Any help would be appreciated!
     
  2. Ziggy1

    Ziggy1

    Joined:
    Jun 17, 2002
    Messages:
    2,551
    All you need to do is create a query, add your primary key and whatever field you want to Count. then on the view menu select "Totals", the fields will default to Group by. change the one you are trying to count, to count. Then run.

    *keep in mind that you may have to add additional fields fto "Group by" depending on the level you are trying to count, but don't try to create the full detail, you must group in order to get the count you are trying to achieve.....

    this query can be joined to another table/query to show the count at the full record level, I can explain further if you don't know what I mean.
     
  3. Sonny100

    Sonny100 Thread Starter

    Joined:
    Jul 10, 2006
    Messages:
    8
    The primary key that i'm referring to is in a differant table, but it's shown on the same form.

    I have a form that feeds from one table, and on that form I have fields that gather information from a second table. I need to create an expression that searches for the number of records in the second table, that contain the primary key from the first.

    The first table is a list of IT analysts, and the second is a list of service calls logged. I'm trying to create a form that displays the analysts names as each record, and within that, the amount of calls that they have logged (type etc).
     
  4. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Sonny100, Ziggy1's Query will provide what you have described. If you want to list the records that is a different matter.
    can you post a zipped copy of the database, less the data if necessary.
     
  5. Sonny100

    Sonny100 Thread Starter

    Joined:
    Jul 10, 2006
    Messages:
    8
    Fantastic!!

    Sorry guys, I didn't realise that you could run a query that gathers information from two differant tables! (i'm fairly new to Access!)

    I now have the results that I require, that you very much for your help!!
     
  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/481996

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice