Results 1 to 4 of 4
  1. #1
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    239

    Count and Dcount not working

    Hi,

    I have these two functions set in Textbox Control source:
    Code:
    =Count([ID_Field])
    Code:
    =DCount("*";"RecordsFromAnotherTable")
    Both textboxes are on same form. COUNT function is used to count records on this form, and DCOUNT is used to count records in different table. Both functions work, but when form has 0 records, both function stop working. No errors, but simply not displaying anything. I understand that COUNT should have problems with It, since It's recordsource is 0. But DCOUNT that counts records in another table ? What is wrong ?
    I tried with Nz function for count (not working):
    Code:
    =Count(Nz([ID_Field];0))
    Anybody have an idea ?

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Check the help for syntax...
    dcount("*","table") ' comma delimiter

    =count... Works in report/form fields.
    NZ.....comma!!

  3. #3
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    239
    Hi ranman,

    I'm checking all over sites, but haven't found anything to solve this. What I need is only to have textbox that will show number of records of form currently opened, and number of records from table that isn't opened.

  4. #4
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    239
    Arghhh,

    I figured out what is problem - Allow Additions of form must be set to True, then both of functions work when records are 0. Problem solved.

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

Similar Threads

  1. Can I Make Access DCount Emulate Count?
    By tgall in forum Forms
    Replies: 8
    Last Post: 02-10-2016, 08:25 AM
  2. DCount to count unique values
    By nlkehl in forum Queries
    Replies: 3
    Last Post: 06-09-2014, 10:46 AM
  3. Count or DCount Not Working Properly
    By Chris1112 in forum Forms
    Replies: 3
    Last Post: 05-09-2012, 02:51 PM
  4. Count Vs Dcount
    By SWG in forum Access
    Replies: 1
    Last Post: 03-30-2012, 02:08 PM
  5. Using count or Dcount
    By ddcook in forum Access
    Replies: 0
    Last Post: 07-22-2009, 03:35 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