Form Text Box #Name? (1 Viewer)

Andr3wski

New member
Local time
Today, 15:58
Joined
Aug 24, 2023
Messages
1
This should be straight forward. I have a database I've constructed myself through self teaching so please be patient.

There are 2 tables; UnitsT, ComplaintsT.

I have a main menu form that has several buttons to pull up various other forms for entering new complaints, editing complaints, and a continuous form to view all complaints saved.

I am adding more functionality to the main menu and have now wanted to include text box fields that show the total complaints received and non-violations (these are a check box in on of the columns in the ComplaintsT table).

The text box on the main menu for total complaints works perfect. In the Control Source field under Data tab I entered: =Format(DCount("Address","ComplaintsQ"),0)

This returns the total count I have in a Query (ComplaintsQ) that pulls from the complaints table. The Query has totals at the bottom set to count for the Address and Non-Violation fields.

However I've tried may different ways for the Non-Violations text box and get this error. And have spend countless hours digging online. I feel it has to do with the checkbox and maybe how it reads the -1 and 0. I'm not sure.

If there is someone out there willing to throw me some knowledge. It would be much appreciated.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 17:58
Joined
Feb 28, 2001
Messages
27,189
The #Name error usually means that you specified a field to which to bind the text box (or other text-bearing objects like combos) but the name of the field that feeds the text is somehow incorrect. It can EITHER be (a) a simple field-spelling error or (b) the field in question is specified as being in another table (mis-location or table-name-spelling error) that the form's control cannot find. In either case, Access is telling you that you told the text box to look for something by name (hence the #Name usage) but Access can't find it spelled that way.
 

Gasman

Enthusiastic Amateur
Local time
Today, 23:58
Joined
Sep 21, 2011
Messages
14,310
Not sure why you want format on a dcount, but the format mask is a string not numeric?
 

CJ_London

Super Moderator
Staff member
Local time
Today, 23:58
Joined
Feb 19, 2013
Messages
16,616
Why not show what doesn’t work? You showed what works - leaving us to guess at what doesn’t work

for a yesno field in a table, the values can only be 0 and -1, so unless you are including a criteria, your dcount will return the wrong value
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 18:58
Joined
Feb 19, 2002
Messages
43,293
You have two things to count so use two DCounts but use criteria rather than a query that counts only one thing. There is no way to programmatically reference the automatic totals created by the Sigma button.

Also Format() turns things into a string so we would almost never format numeric values. Use the Format property of the control instead.
 

Users who are viewing this thread

Top Bottom