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

Count selected rows in a table and show in this in a form

17
Hello all, after getting no where with my Access 2007 database problem for an entire week I figured I could use some outside help.

Wanting to skill myself in Access, I decided to make a movie database, something I always wanted. It took me some trial and error, but as it now stands, I made several tables (Companies, Cast, Genre, Country, Character, Director, Status, Movies)... The table Movies contains all the info on each movie while the others contain things like all the companies, countries, actors, etc.

Around this table (currently with 16 movies) I build a user friendly form where I can select anything I want with each new entry (the director, actors, year, etc...) and one field in that form is not giving the result I want.

In the table Status there is only 1 column (Status) and only 3 rows (Seen, Not Seen, See). So in the form I can select whichever applies to a specific movie. This works perfectly. In the form I added a field where I want it to automatically show the number of movies I've seen (currently 14 out of the 16). In the Property Field of that text box, I selected the tab Data. Next to Control Source I made a formula in the Expression Builder. The formula I used to see the total number of movies in the database (which took me a while to figure out) was:

=Count([Status])

This works as it shows the number 16. But I can't manage to see the number of movies I've seen (14). I've tried a lot of things, and all produce the number 0, -1 or an error. I figured the right code was:

=Count([Status]) Like 'Seen'

But this gives me back a 0. I even tried approaching the problem by several times making a query (I named it Viewed) containing all the data but only of the movies I've seen.
But when trying to linking the formula to the query I get a constant error code.

I hope the problem is reasonable clear to anyone reading this somewhat long story, considering access is totaly new to me and English isn't my main language. Should something be unclear or anything just let me know.

Greetings Margie
Jan 31 '08 #1
3 4865
ADezii
8,834 Expert 8TB
Hello all, after getting no where with my Access 2007 database problem for an entire week I figured I could use some outside help.

Wanting to skill myself in Access, I decided to make a movie database, something I always wanted. It took me some trial and error, but as it now stands, I made several tables (Companies, Cast, Genre, Country, Character, Director, Status, Movies)... The table Movies contains all the info on each movie while the others contain things like all the companies, countries, actors, etc.

Around this table (currently with 16 movies) I build a user friendly form where I can select anything I want with each new entry (the director, actors, year, etc...) and one field in that form is not giving the result I want.

In the table Status there is only 1 column (Status) and only 3 rows (Seen, Not Seen, See). So in the form I can select whichever applies to a specific movie. This works perfectly. In the form I added a field where I want it to automatically show the number of movies I've seen (currently 14 out of the 16). In the Property Field of that text box, I selected the tab Data. Next to Control Source I made a formula in the Expression Builder. The formula I used to see the total number of movies in the database (which took me a while to figure out) was:

=Count([Status])

This works as it shows the number 16. But I can't manage to see the number of movies I've seen (14). I've tried a lot of things, and all produce the number 0, -1 or an error. I figured the right code was:

=Count([Status]) Like 'Seen'

But this gives me back a 0. I even tried approaching the problem by several times making a query (I named it Viewed) containing all the data but only of the movies I've seen.
But when trying to linking the formula to the query I get a constant error code.

I hope the problem is reasonable clear to anyone reading this somewhat long story, considering access is totaly new to me and English isn't my main language. Should something be unclear or anything just let me know.

Greetings Margie
Set the Control Source of a Text Box on your Form to (assumes Table Name is tblMovies):
Expand|Select|Wrap|Line Numbers
  1. =DCount("*","tblMovies","[Status] = 'Seen'")
Jan 31 '08 #2
Margie
17
Set the Control Source of a Text Box on your Form to (assumes Table Name is tblMovies):
Expand|Select|Wrap|Line Numbers
  1. =DCount("*","tblMovies","[Status] = 'Seen'")
Many Thanks ADezii! It works perfectly. The exact code for me was:
Expand|Select|Wrap|Line Numbers
  1. =DCount("Status";"Movies";"[Status] = 'Seen'")
Thank you again for your help and quick response! Margie
Jan 31 '08 #3
ADezii
8,834 Expert 8TB
Many Thanks ADezii! It works perfectly. The exact code for me was:
Expand|Select|Wrap|Line Numbers
  1. =DCount("Status";"Movies";"[Status] = 'Seen'")
Thank you again for your help and quick response! Margie
You are quite welcome, Margie.
Feb 1 '08 #4

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

Similar topics

20
by: WindAndWaves | last post by:
Hi Gurus I was wondering if you can send me in the right direction: I have a table with about 300 rows. I want to make all of them invisible and when a user enters a code in a form then make...
4
by: Cris Teta | last post by:
Hi to all, im just newbie in javascript and html dom. I just want to know how will i get the total number of rows in a certain html table? Please help, it will be very much appreciated. Thanks...
22
by: Joseph Shraibman | last post by:
On a 7.3.4 database: explain analyse select count(*) from elog; Aggregate (cost=223764.05..223764.05 rows=1 width=0) (actual time=81372.11..81372.11 rows=1 loops=1) -> Seq Scan on elog ...
2
by: Alpha | last post by:
I have a window application. In one of the form, a datagrid has a dataview as its datasource. Initial filtering result would give the datavew 3 items. When I double click on the datagrid to edit...
6
by: Tejpal Garhwal | last post by:
I have datagrid filled with some data rows. At the run time i want know how many total rows are there in the data grid ? Any idea ? Any Suggestions ? Thanks in advance Tej
0
by: tania | last post by:
i have this table in my database: CREATE TABLE FILM( F_ID INT(5) NOT NULL AUTO_INCREMENT, F_TITLE VARCHAR(40) NOT NULL, DIRECTOR_FNAME VARCHAR(20) NOT NULL, DIRECTOR_LNAME VARCHAR(20) NOT NULL,...
5
by: Marshallp24 | last post by:
Hi, I need to be able to display a count of records in a message box but with a criteria of the just ones where there is a yes in a certain field. so the message box will pop up saying something...
30
by: SSG001 | last post by:
Hi, I'm using scriptaculous autocomplete for my text box and it works perfectly ok i have made server.php for fetching the values in the ul list and it is shown correctly on the main form but after...
1
by: kummu4help | last post by:
hi, i am using mysql. i have 3 tables with following structures. these are not actual tables i am working on. table A id varchar(16),name varchar(255),InDate datetime table B id...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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: 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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.