Solved Dcount not working

OnePoint Consulting

New member
Local time
Today, 19:03
Joined
Apr 2, 2020
Messages
15
Hi guys, i've got a small problem trying to get an unbound textbox on a Form to give me the amount of "assignments" with the Status "Open" from my table "Aufträge Eintragen". I've got about 4h of ACCESS experience, so i'm an aboslute newbie to this. Plus i have no experience what so ever in coding etc.

I've been using the Dcount function but it keeps responding with "#Name?"... What exactly am i doing wrong? can someone help me out pls?
I work in german, hope these help:

DBAnzahl = Dcount (at least i think)
Auftrag = Assignment
Offen = Open

I've been using this function:
=DBAnzahl("[Auftrag]","Aufträge Eintragen","[Status]='Offen'")
 

Attachments

  • ACCESS.png
    ACCESS.png
    228.8 KB · Views: 113
you have a space in your table name (not a good idea to use spaces so you need to use square brackets)

=DCount("[Auftrag]","[Aufträge Eintragen]","[Status]='Offen'")
 
Thanks for the reply CJ.

I've copied and tried it but it still isn't working… Access is giving me some sort of syntax error message or something like that, speaking of operators and operants.

I noticed that the table name is acutaly "Tasks" and not the former above (thats the name of the shortcut / see the file that i've attached before). Where do you think the problem is?

woult it help if i'd upload the file for you to see?
 
same thing, just change the table name:

=DCount("[Auftrag]","[Tasks]","[Status]='Offen'")
 
I noticed that the table name is acutaly "Tasks" and not the former above (thats the name of the shortcut / see the file that i've attached before). Where do you think the problem is?
So have you tried it using Tasks
 
i Tried it with "Tasks" and it still results in the sam error message… I really don't know where the problem could be.
 
maybe try again:

=DBAnzahl("[Auftrag]","[Aufträge Eintragen]","[Status]='Offen'")
 
is your status field a text field (look at the table design) - usually for just two options (open/closed) it would be a boolean or numeric field
 
Thanks for all the replies! I'll just upload the File so you guys can have a look at what i've done (or in this case "haven't done yet")

The unbound textbox in question is on the Menu form; "Offene Aufträge"

And yes, the "Status" fields are text-fields
 

Attachments

Last edited:
ok, so how exactly should i enter that? i've never worked with vba or the immediate window "function"?
 
Arnels code in post 4 works for me.
You need to get rid of the lookup fields in your table

google "the evil of lookup fields"
 
=dlookup("[Auftrag]","[Tasks]","[Status]='Offen'")
also works in the forms textbox.
I suspect that you will need to add to your criteria though because you have many records marked "Offen"
 
So, no matter what i try i always end up with the same error code. Did you guys make any changes to the document prior to entering the function?

The error code roughly translates to:

The expression you entered is syntactically incorrect.
You have not specified an operand or operator, you have entered an invalid character or comma, or you have entered text without placing it in quotation marks
 

Attachments

  • error msg.png
    error msg.png
    234.1 KB · Views: 112
Arnels code in post 4 works for me.
You need to get rid of the lookup fields in your table

google "the evil of lookup fields"
how do i do that?

i'm really sorry if im sounding dumb…

edit - found out what you mean with the Lookup field... what other way could i use to get the same result as a "lookup field"? possible?
 
would it be possible for someone to make the changes and then reupload the file, so i can just continue working with the changes already made?

maybe i'll then understand what i did wrong, or so...

That woul be really great =)
 

Users who are viewing this thread

Back
Top Bottom