Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2015
    Posts
    22

    Answered: Query or calculated field in a form

    Hi all,

    I have a question about forms.
    I have created one in order to import details in a table but I would like to have a separate field that will count the number of records for a given date.
    So when I enter the new record and place the details (+ the date), I want the field (or text box) to present the number of the records that are already registered in the table with the same date.

    Can anyone please help? Thanks!

  2. Best Answer
    Posted by ranman256

    "on the form use a Dcount for the textbox.
    =Dcount("*","table","[date]=#" & cboDate & "#")

    or
    on the form put a counter in the footer,then you can filter the records and see the count: =Count(field)"


  3. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    628
    Provided Answers: 32
    on the form use a Dcount for the textbox.
    =Dcount("*","table","[date]=#" & cboDate & "#")

    or
    on the form put a counter in the footer,then you can filter the records and see the count: =Count(field)

  4. #3
    Join Date
    Oct 2015
    Posts
    22
    I am doing something wrong here and I get a "#name?" error... I read this solution also from another source but I can't do it.

    What can possible go wrong with the below command and return the error?

    Can you also let me know what is the cboDate? Is it linked somehow with my date field? The name of my field is "MDATE".

    =DCount("*";"TRACKING";"[date]=#" & [cboDate] & "#")

  5. #4
    Join Date
    Oct 2015
    Posts
    22
    I am getting somehow closer... I now receive the value "0" with the below function, although I have records on this date.
    Something is wrong with the date criteria but I can't tell by myself.

    =DCount("[MDATE]";"TRACKING";"[MDATE]=#" & [MDATE] & "#")

  6. #5
    weejas is offline Grumpy old man (training)
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    1,101
    Provided Answers: 17
    That function should work if the field in the table is called MDATE. You might want to remove the brackets from the name of the form control.
    10% of magic is knowing something that no-one else does. The rest is misdirection.
    Beers earned: 2

  7. #6
    Join Date
    Oct 2015
    Posts
    22
    Don't bother, it was a formatting case problem. Now it is solved!

    Thanks!

    =DCount("[MDATE]";"TRACKING";"[MDATE]=#" & Format([XDATE];"mm/dd/yyyy") & "#")

Posting Permissions

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