473,386 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Counting Specific Records within a Table

10
Using Access 2010, I would like to count all check amounts greater than $50 within a table. So far I’ve used the expression
Expand|Select|Wrap|Line Numbers
  1. = DCount("[ChkAmt]","tblChecks","txtChkAmt > 50")
, but this expression results in “#Error”. I believe I may have a problem with the “Domain” part of the syntax. The Objects and Controls I’m using are: tblChecks (a Table); ChkAmt ( a Field); and txtChkAmt (a Text Box). I would appreciate any assistance with my issue. Thanks in advance.
Jun 19 '13 #1

✓ answered by Mihail

As far as I know, NO brackets are necessary in DCount function:
Expand|Select|Wrap|Line Numbers
  1. =DCount("ChkAmt","tblChecks","ChkAmt>50")

7 1103
Rabbit
12,516 Expert Mod 8TB
Use the field in your database, not the control in your form.
Jun 20 '13 #2
Tempo
10
Hi Rabbit! Thanks for responding. I modified the expression to
Expand|Select|Wrap|Line Numbers
  1. =DCount("[ChkAmt]","tblChecks","[ChkAmt]>50") 
and
Expand|Select|Wrap|Line Numbers
  1. =DCount("[ChkAmt]","tblChecks","[ChkAmt]">"50")
. In both instances the result was #Error. Does the solution have anything to do with whether or not I'm using brackets and quotes appropriately?.

I would have responded sooner, but was searching the site for issues the same as or similar to mine.
Jun 20 '13 #3
Rabbit
12,516 Expert Mod 8TB
You have an extra double quote that popped out of nowhere. It wasn't in your original code.
Jun 20 '13 #4
Tempo
10
I was experimenting with different bracket and quote positions, but none of my combinations appear to work. Here's the last failed attempt:
Expand|Select|Wrap|Line Numbers
  1. =DCount("[ChkAmt]","tblChecks","[ChkAmt]>50")
Jun 20 '13 #5
Mihail
759 512MB
As far as I know, NO brackets are necessary in DCount function:
Expand|Select|Wrap|Line Numbers
  1. =DCount("ChkAmt","tblChecks","ChkAmt>50")
Jun 20 '13 #6
Mihail
759 512MB
Again, as far as I know, this structure is available for all D functions.
Jun 20 '13 #7
Tempo
10
You're absolutely correct, Mihail, brackets are necessary when numbers, spaces, or some other character is used in Object and Control names.

When you included the expression I sent I could clearly see my mistake. A small, but critical one at that. Are you ready? The domain is "tblCheck" not "tblChecks".

There you are...problem resolved. Much thanks goes out to you and "Hats Off" to Rabbit as well. You guys are Great!
Jun 20 '13 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Dave | last post by:
I have a form which is based on a table (a) with over 6000 records.I have a button on this form which will open another form with related data from another table (b). What I want to do is open the...
6
by: RC | last post by:
My code below will loop through all the records in the table, and when the if statement is true it goes to the ***Me.ContainerNumberProductsTable = GETContainerNumber.Value*** bit like should but...
3
by: Larry Rekow | last post by:
As part of a macro, I'm trying to automate appending a table with new records. let's say the table 2 has some new records in it, but also has a lot of identical records to table 1. I would...
4
by: jean.ockert | last post by:
Greetings. Access version 2003 on an XP system I am using the template "Event Management" database as the primary database and need additional functionality added. I have a dance studio. ...
4
by: Stinky Pete | last post by:
Hi, In order to keep the file that's in development up to date with the reference (and still used) file, I need to regularly import the original main table and then physically select and append...
2
by: kevinjbowman | last post by:
I am by no means a SQl Jedi as will be apparent by my question, but I can usually figure out a select statement on my own. I have one today though that really has me stumped. I am working in...
2
by: Viktor | last post by:
I have a problem with counting empty fields in table. For example: I have the field in which i coulld write several solutions. "done", "not done", "send", "not send" etc. In report i want to...
16
by: mim77 | last post by:
Hi, I'm very rusty with Access programming. I hope someone can help me. I'm trying to include a count of the number of specific records in a field. Values for the records in the field are either...
3
by: Okonita via DBMonster.com | last post by:
Hi all, Working on a little shell script to remove specific records from a flat file. I have scanned a one or two script books and googled for answers but have no success. Can someone show me how...
8
by: KPR1977 | last post by:
Below is a very handy function that transposes fields from "Table1" into "Table2". Note, in Table1 the Field2, Field3, etc represent Option codes. Basically it takes this... Table1 ProdBreakDown...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.