Solved Dcount not working (1 Viewer)

OnePoint Consulting

New member
Local time
Today, 02:51
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: 70

CJ_London

Super Moderator
Staff member
Local time
Today, 01:51
Joined
Feb 19, 2013
Messages
16,553
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'")
 

OnePoint Consulting

New member
Local time
Today, 02:51
Joined
Apr 2, 2020
Messages
15
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?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 09:51
Joined
May 7, 2009
Messages
19,169
same thing, just change the table name:

=DCount("[Auftrag]","[Tasks]","[Status]='Offen'")
 

bob fitz

AWF VIP
Local time
Today, 01:51
Joined
May 23, 2011
Messages
4,717
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
 

OnePoint Consulting

New member
Local time
Today, 02:51
Joined
Apr 2, 2020
Messages
15
i Tried it with "Tasks" and it still results in the sam error message… I really don't know where the problem could be.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 09:51
Joined
May 7, 2009
Messages
19,169
maybe try again:

=DBAnzahl("[Auftrag]","[Aufträge Eintragen]","[Status]='Offen'")
 

CJ_London

Super Moderator
Staff member
Local time
Today, 01:51
Joined
Feb 19, 2013
Messages
16,553
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
 

OnePoint Consulting

New member
Local time
Today, 02:51
Joined
Apr 2, 2020
Messages
15
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

  • Taskmaster ACCESS - Kopie.zip
    28.4 KB · Views: 64
Last edited:

OnePoint Consulting

New member
Local time
Today, 02:51
Joined
Apr 2, 2020
Messages
15
ok, so how exactly should i enter that? i've never worked with vba or the immediate window "function"?
 

moke123

AWF VIP
Local time
Yesterday, 21:51
Joined
Jan 11, 2013
Messages
3,852
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"
 

bob fitz

AWF VIP
Local time
Today, 01:51
Joined
May 23, 2011
Messages
4,717
=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"
 

OnePoint Consulting

New member
Local time
Today, 02:51
Joined
Apr 2, 2020
Messages
15
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: 68

OnePoint Consulting

New member
Local time
Today, 02:51
Joined
Apr 2, 2020
Messages
15
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?
 

OnePoint Consulting

New member
Local time
Today, 02:51
Joined
Apr 2, 2020
Messages
15
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

Top Bottom