Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding up Yes values PLEASE HELP

Status
Not open for further replies.

THEJOESTER

Technical User
Jul 6, 2006
39
US
Hi, is there any way i can add up the yes values in a table and view them in a textbox/label in a form. For example, My table contains the field for reservations. The values are yes/no, but on the same form that I am making the reservations, I need to know how many reservations there are. so I need to add up all the yes values in the "reservations" column, and be able to view this value on the form.

Much Appreciated.
 
It isn't at all clear how your table(s) are structured. If you want to count the number of Yes (yes/no field) values in a field, use
Sum(abs([YourYesNoField]))

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Ok, I have a more complicated situation. I have one table with fields: CustomerID, Train Date, Train Time, First Name, Last Name, Zip Code, Adult Tickets, Children Tickets, Senior Tickets, Payment (list box cash, check, CC), Reservations (yes/no). I need the text box to count up all the reservations for todays date, the current hour (to the next hour, so 9:06 would round up to 10:00). How would i go about doing this? Do I use a query for this?
 
First, you table structure isn't what I would consider normalized. I would store ticket purchases in a related table with fields like:
tblCustomerTickets
====================
CustomerID
NumOfTickets
TicketType (children, senior,...)
(Pmts and reservations could go here or in the main table depending on how you do business)

You could then do a totals query that sums NumOfTickets by Date and Time. You will need to create a small function that rounds times up to the next highest number.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top