473,382 Members | 1,204 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,382 software developers and data experts.

Counting a value on a form from all records in a table.

13
I am trying to enter a control on a form which can count the total number of entries with a particular value. For example, I have a field on my form which holds a cell phone number. I would like to create a separate field which counts the total number of entries with the same cell phone number. This will help me from entering duplicate records. I know how to count the actual field; =count(cellphone). I found some people online mentioning to use the sumif with the count. The problem is I cannot get the correct syntax. Currently I have = sumif(count(cellphone = me!cellphone,1,0) but I am getting syntax errors; missing parenthesis. Can anyone help? is this possible?
Mar 19 '13 #1
2 1152
Seth Schrock
2,965 Expert 2GB
Well, the missing parenthesis error is because you are missing an ending parentheis at the end of the expression. Each parenthesis must be paired up with another so that there is a starting and ending parenthesis. I'm not familiar with the SumIf() function, but you would at least need to make it =SumIf(Count(CellPhone = Me!CellPhone,1,0)). Also, I don't think that you can use the Me! reference in the textbox. You would have to use the full reference.

My recommendation to solve your problem would be to use DCount(). To make it so that it is easy to refresh it, I would put this in the control's OnClick event:
Expand|Select|Wrap|Line Numbers
  1. Me!cellphone = DCount("*", "enter the table name here", "Cellphone = " & Me!cellphone)
Mar 19 '13 #2
zmbd
5,501 Expert Mod 4TB
Unless it is a subform, you should be able to refer to the controls directly by name:
Me!cellphone = DCount("*", "enter the table name here", "Cellphone = " & [cellphone])
Mar 19 '13 #3

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

Similar topics

2
by: Remco Groot Beumer | last post by:
Hello, I created a program in which I use modules and classmodules for setting my variables. For example when I need to set the customerID in a variable I use something like: ...
2
by: Bill Hand | last post by:
Is it possible to open a form from table and have it access a given record? I want to be able to query all baseball cards with the last name Jones and have it open a table. In each record of...
1
by: Tom | last post by:
hello i have 2 tables linked by a common id. The first table has records with a specific field with numeric values. eg 3 or 6 or 10 etc. What i want to happen is when i create a data entry form, i...
3
by: KayC | last post by:
Hi Background info: I am running Access 2000 I have a form bound to a blank table When a user clicks a button the form opens in datasheet view User enters data into form and closes form User...
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...
11
by: redantho | last post by:
As a relative beginner with Access/VBA (2003 version), I am looking for a solution to what seems to be a fairly simple problem... When a user inputs a text string in a form object, I would like...
2
by: skeata | last post by:
Hi, I'm having a major dilemma here. I know it's not very difficult in a sense, but any help will be greatful. So, with no more delay, here is my problem: I created a form called...
5
by: Rex | last post by:
Hi, I want to change a value in one table depending on the value(s) in another table. I am trying to achieve this in a form. to elaborate I have a many-to-many relationship between tables...
1
by: boss1 | last post by:
hi all, i m new in php.i have a problem that is i m using a php form where i can retrieve one field value from one table in oracle db by ajax and its working properly. but i need to insert the...
2
by: Hillwalker | last post by:
Hi Raw recruit, no VB knowledge but some general programming experience..... Access 2000 on XP In form view, I wish to fill the field (ONLY on the record being viewed) with the maximum value...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.