473,612 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form/TextBox/Count Function problem

Lensmeister
15 New Member
I am getting a little better on this Access DB (in Access 2003) I am making although I am having one problem at this time I cannot fathom out.

I have a form (frm_Stats) This form has the following textboxes on it
1. Total Number of Records in the table Matches.
2. Total Number of Records in the table tbl_Players.

Once I get over these I can move on a bit.

OK the problem:

I have the form and the textbox. In the "control source" I have the following Formula which I found on a website:
=Count([Matches])

when I open the form up it shows
#Error

Anyone have any ideas how to overcome this. I have also tried
=Count([tbl_Players])

Again that came up with
#Error

Thanks in advance.
Mar 6 '09 #1
6 10560
Stewart Ross
2,545 Recognized Expert Moderator Specialist
The #Error message usually arises when you supply a field name that is not recognised as part of the underlying recordset, or when you have accidentally set the name of the unbound control concerned to be the same as an existing field (which would prevent Access from knowing which one to apply).

Simplest answer, since Count does not need a field name, is to set the control source to be

=Count(*)

This will give you a count of the number of records in the recordset underlying your form. However, if you are using an unbound form (one that is not bound to a query or table) you have nothing to count.

If this is the case you can perform a lookup of the count of the number of records in a table by using the DCount function:

=DCount("*", "tbl_Player s")

-Stewart
Mar 6 '09 #2
Lensmeister
15 New Member
Hi Stewart,

Thanks for that. It is a unbound form. Can I confirm that if I wanted to cont the number of "W" in the table Matches in the column/Field R the formula would be

=Dcount("W","Ma tches","V") ? ? ? ? ?

Lensmeister.
Mar 8 '09 #3
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Not quite; DCount (like the Count function) counts the number of rows in the dataset. To count rows that have 'W's (or any other value) in them you need to restrict the rows being counted to be only those where the field or fields concerned have that value. DCount can do this, using its WHERE clause (which is like an SQL WHERE clause without the word WHERE. For a string comparison use the first form of the DCount below, for a number use the second:

Expand|Select|Wrap|Line Numbers
  1. DCount("[name of some field]", "[your table name]", "[field you want to compare] = 'W*'")  ' < string form
  2. DCount("[name of some field]", "[your table name]", "[field you want to compare] = 123456) ' < numeric form
-Stewart
Mar 9 '09 #4
Lensmeister
15 New Member
Hi,

I have the Unbound form with a textbox on it.

Expand|Select|Wrap|Line Numbers
  1. =DCount("[R]","[Matches]","[R]"='W')
is in the 'control source'

In the Matches table there are 2 "W" and only 1 "L". in the column/field "R" (R=Result).

When I view the form it comes up with a "0". I tried to remove the 1st and 2nd [R] but they didn't work either.

Am I missing something ?

Lensmeister.
Mar 9 '09 #5
Stewart Ross
2,545 Recognized Expert Moderator Specialist
If what you have posted is accurate you have the closing double quote in your WHERE clause in the wrong place:

Expand|Select|Wrap|Line Numbers
  1. =DCount("[R]","[Matches]","[R]='W'")
As a piece of advice, give your fields meaningful names. [R] is not in any way intuitive or helpful. It should really just be Result...

-Stewart
Mar 9 '09 #6
Lensmeister
15 New Member
Thanks mate ... that works perfect.

the field called R is for result, but it's an old Excel database I set up about 12 years ago and I am used to what each one means .... I am a creature of habit so R was the easiest for me at the time.

I will think about getting it changed once I got my head round this DB ..

Again thanks mate .... :) :) :)
Mar 9 '09 #7

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

Similar topics

10
19341
by: Gregory A Greenman | last post by:
I'm trying to write a program in vb.net to automate filling out a series of forms on a website. There are three forms I need to fill out in sequence. The first one is urlencoded. My program is able to fill that one out just fine. The second form is multipart/form-data. Unfortunately, I haven't been able to fill that out in a way that makes the server happy. I set up a copy of this form at my web site so that I could see exactly what a...
2
13694
by: anonieko | last post by:
This applies to javascript dynamic textbox onkey > > > Newsgroups: comp.lang.javascript From: Lasse Reichstein Nielsen <l...@hotpop.com> - Find messages by this author Date: Fri, 15 Jul 2005 18:39:24 +0200 Local: Fri,Jul 15 2005 12:39 pm Subject: Re: Summer 2005 browsers' test set ?
0
1878
by: 42 | last post by:
I implemented a simple class inherited from Page to create a page template. It simply wraps some trivial html around the inherited page, and puts the inherited page into a form. The problem I have run into is that the emitted html at the end of the process is slightly different and doesn't work. Please don't be put off by all the source code. All the guts are in this first base class, and it doesn't do much. The rest is trivial...
25
4047
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
4
5317
by: Lee Chapman | last post by:
Hi, Can anyone tell me why in the code below, the call to ClearChildViewState() has no effect? To paraphrase the code: I'm using view state. I have a textbox and a submit button (and a label that can be ignored). When I press the button the first time, the click handler hides the textbox. Pressing the button a second time unhides the textbox. The text box is maintaining its value when hidden via view state. (The value is NOT being...
14
2279
by: Professor Yonce | last post by:
I have made form for E-Mail. I have entered code but the Import system does not work. It has squiggly line underneath it showing it is not communicating. It Will not build. Public Class Form3Bio1 System.Net.Mail.SmtpClient Imports System.Net.Mail ' This line before ' does not work. I have the rest of code to try if and when I am able to get System working. ' I XXX out certain entrys below just for this publication.
0
2743
by: neonspark | last post by:
I'm buidling some simple macro functionality for my app so the users can record a sequence of keyboard inputs and replay them reliably via some menu. Originally, I used: protected override bool ProcessCmdKey(ref Message msg, Keys keyData) To map "Keys" objects to their string constant, and stored them on a string Queue as they were happening. Then (after resetting the form), I simulate replaying of these actions by flushing the queued...
3
4920
by: hugo | last post by:
Hi, I have a function that I call from form fields using the OnKeyUp function to replace special caracters. Once this function has been called, it does not set the focus on the form field where I have called the function from. What happens : I laod a EDIT page with a html form on it and fill in the fields with
13
3240
JodiPhillips
by: JodiPhillips | last post by:
G'day, I have a silly and simple problem that I need some guidance with. Due to the way our network is set up, I am unable to use the group permissions for Access and have had to implement log in procedures via a log in table within the database. This works fine. I have now expanded this table to include further data about the authorised user – Power User, Team Leader, & Facilitator. Depending on the user’s status as to which one of...
0
8605
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8565
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8246
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8415
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7039
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5532
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4045
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2550
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1695
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.