DCount in Microsoft Access: Count Records in a Table or Query. Show Order Count on Customer Form

Поделиться
HTML-код
  • Опубликовано: 26 июл 2024
  • In this video, I will show you how to count up values from a table or query. We will count up the total number of orders that a customer has and display them on the customer form.
    Roberto from Silver City, New Mexico (a Gold Member) asks: I'd like to be able to quickly see the total number of orders that a customer has when I open up their record in the customer form. Right now, I have to open up the order form and look at the number on the bottom. This would save me a lot of time.
    Silver Members and up get access to an Extended Cut of this video. Members will see how to use DCount to limit the number of records in a related table (such as in a subform). This would be handy to, for example, set a maximum number of students per class, or a minimum number of items per order. We'll also see how to refresh a parent form when a child form is closed, and put that order count in the button caption. We'll also discuss why you should not use D-functions in queries (use aggregate queries instead).
    MEMBERS VIDEO:
    • DCount - MEMBERS ONLY ...
    BECOME A MEMBER:
    RUclips: / @599cd
    or My Site: 599cd.com/THMember
    LEARN MORE:
    599cd.com/DCount
    LINKS:
    Concatenation: 599cd.com/Concat
    NZ Function: 599cd.com/NZ
    DLookup: 599cd.com/DLookup
    DMax: 599cd.com/DMax
    Access Expert 29: 599cd.com/ACX29
    COURSES:
    FREE Access Beginner Level 1: 599cd.com/Free1
    $1 Access Level 2: 599cd.com/1Dollar
    FREE TEMPLATE DOWNLOADS:
    TechHelp Free Templates: 599cd.com/THFree
    Blank Template: 599cd.com/Blank
    Contact Management: 599cd.com/Contacts
    Order Entry & Invoicing: 599cd.com/Invoicing
    More Access Templates: 599cd.com/AccessTemplates
    ADDITIONAL RESOURCES:
    Donate to my Tip Jar: 599cd.com/TipJar
    Get on my Mailing List: 599cd.com/YTML
    Contact Me: 599cd.com/Contact
    TechHelp: 599cd.com/TechHelp
    Consulting Help: 599cd.com/DevNet
    Twitter: / learningaccess
    en.wikipedia.org/wiki/Microso...
    products.office.com/en-us/access
    microsoft.com/en-us/microsoft...
    KEYWORDS:
    microsoft access, ms access, #msaccess, #microsoftaccess, #help, #howto, #tutorial, #instruction, #learn, #lesson, #training, #database, dcount, count records, order count, total number of records, limit number of items, maximum, refresh parent form, button caption, aggregate query
    QUESTIONS:
    Please feel free to post your questions or comments below. Thanks.

Комментарии • 19

  • @michelleandreawilliams1798
    @michelleandreawilliams1798 Месяц назад

    BRILLIANT!!! Thank you. Helps my team tremendously!!!

  • @Mislco
    @Mislco 3 месяца назад

    I've been all over your videos lately. I'm making my own database. Love it. Hoping to scrounge up some money to join.
    This video, particularly, helped a ton. I'm using it on my "DashboardF" to count some stuff. I even modified your calculation successfully. Pretty proud of that. But, I did run in to an issue when trying to count "Open Tasks" which is determined on whether or not the "DateCompleted" field is filled or not. So, I was trying to do a "WHERE" function where "DateCompleted=Null". No luck. I tried false and 0 as well. Not sure what I'm doing wrong. I'll probably find it in another video. Just wanted to share, though.
    Thanks a TON for doing what you do!

  • @tiramo36
    @tiramo36 2 года назад

    I follow you from dakhla in kingdom of Morocco 😁😁😁😁😁😁

    • @599CD
      @599CD  2 года назад

      Greetings from Florida. :)

  • @venkatyalamati3285
    @venkatyalamati3285 2 года назад

    Thank you for the video sir.
    Earlier I had faced one problem like I can't open access front end file after changing the directory of (or renaming) /back end file location.
    My self found the solution for this. It is bcz, I have left the system table USysRibbons (which I have configured to hide some options and panes) in the back end file. Make the USysRibbons table as local table in the front end file then problem solved.

    • @599CD
      @599CD  2 года назад

      Cool

  • @user-rd4ne7te5q
    @user-rd4ne7te5q 2 года назад

    hi! Thx for your lessons. Can you help, what i do wrong? Then I use DCount in VBA code, take error "Expected variable or procedure, not project".
    Seems like VBA doesn't see DCount, but see Count.

    • @599CD
      @599CD  2 года назад

      VBA likes DCount just fine. :)

    • @user-rd4ne7te5q
      @user-rd4ne7te5q 2 года назад

      @@599CD what to do if an error appears "Expected variable or procedure, not project" when i use dcount

  • @MaravillaMVS
    @MaravillaMVS 3 года назад

    How do I get the count in query to work on fields that I have lookup, give me an error message of "Data type mismatch in criteria expression". On my table I have a field that has a drop down to select certain data, so I want in the query to pull the one value of the drop down and count it. Hope this makes sense

    • @599CD
      @599CD  3 года назад

      Nope. Not making sense at all. Sorry. You may have to make 2 queries - feed the results from one into a second one.

  • @rclbranch160barons4
    @rclbranch160barons4 Год назад

    Can one use the DCount function in a report that gets it's data from a query? I probably should clarify - I have a report that is opened with a query.. The query has an "Enter Last Name" parameter for one of the fields. Can DCount still be utilized within this report?

    • @599CD
      @599CD  Год назад

      Possible but I'd have to see it to tell you for sure

    • @rclbranch160barons4
      @rclbranch160barons4 Год назад

      @@599CD My query has five fields....."ID", "RenterFirstName", "RenterLastName", "CostBasicTotal" and "FunctionStartDate". RenterLastName has the "Enter Last Name" search parameter. What I would like to do is on the output report, have an unbound textbox that uses DCount to count the total records using the ID field for each specific report, so I don't have to manually count up the rentals shown in the report. As near as I can discover, DCount apparently will not work in this scenario, although for the lie of me I can't figure out why, because the DCount function comes AFTER the query is triggered. My current configuration keeps giving me the "#Error" fault.
      Cheers and thanks for the help and your reply. :)

  • @crazyforcs
    @crazyforcs 2 года назад

    Hello. I'm trying to use this on String field and it isn't working. My goal is to get a row number count for each separate repeating groups. Because Access uses a bizarre old SQL version it doesn't have a basic feature like row_number(). I've tried to do something like: SELECT A.*,
    (SELECT COUNT(*) FROM tblNames WHERE A.ID>=ID) AS RowNum
    FROM tblNames AS A
    ORDER BY A.ID;
    But it isn't working. Do you have any ideas? Thanks.

    • @599CD
      @599CD  2 года назад +1

      I don't understand what you're trying to do.

    • @crazyforcs
      @crazyforcs 2 года назад

      @@599CD Sorry for the bad explanation but I was able to do it. I was trying to emulate the SQL Partition function in Access. My new question is do you know of a way to Transpose data in Access the same way we can do it in Excel? The crosstab query doesn't work the same way.

  • @dbdata9836
    @dbdata9836 Год назад

    Great