Results 1 to 3 of 3
  1. #1
    Patience is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    52

    DCount realtime

    Hi guys,



    I have a DCount function which counts the number of identical records and shows the result in a form. The code is this:

    =DCount("Version";("Tabel - Textile data and test results");("[Code] = Formularer![Textile overview]![Code]"))

    However, I need this calculation to be performed when the fields for a new record is being filled. That is before the record is saved.

    So when the user enters a number in field A and exits the field, then the DCount calculates and instantly shows the result.

    I have tried entering the DCount function in AfterUpdate, Beforeupdate and all the others, but I can not get it to work. It only works when existing records are shown in the form.

    How can I get around this?

    Thanks a lot!

    BR

  2. #2
    Datagopherdan is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Dec 2008
    Posts
    220
    You can requery the form. You would also need to add some code, so the user would return to the record they were on.

    Quote Originally Posted by Patience View Post
    Hi guys,

    I have a DCount function which counts the number of identical records and shows the result in a form. The code is this:

    =DCount("Version";("Tabel - Textile data and test results");("[Code] = Formularer![Textile overview]![Code]"))

    However, I need this calculation to be performed when the fields for a new record is being filled. That is before the record is saved.

    So when the user enters a number in field A and exits the field, then the DCount calculates and instantly shows the result.

    I have tried entering the DCount function in AfterUpdate, Beforeupdate and all the others, but I can not get it to work. It only works when existing records are shown in the form.

    How can I get around this?

    Thanks a lot!

    BR

  3. #3
    Patience is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    52
    Thank you Dan, but I can not do that since many fields in the form are mandatory, so when I requery the form, it informs that not all mandatory fields have been filled.

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

Similar Threads

  1. Combining Two DCount expressions in one
    By nmodhi in forum Forms
    Replies: 1
    Last Post: 02-26-2010, 10:49 AM
  2. Using count or Dcount
    By ddcook in forum Access
    Replies: 0
    Last Post: 07-22-2009, 03:35 PM
  3. Replies: 0
    Last Post: 06-11-2009, 09:51 AM
  4. Dcount on report
    By mattbrem in forum Reports
    Replies: 2
    Last Post: 06-06-2009, 01:33 AM

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