Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 01-12-2015, 11:55 AM   #1
Everterra
Newly Registered User
 
Join Date: Jan 2015
Posts: 16
Thanks: 5
Thanked 0 Times in 0 Posts
Everterra is on a distinguished road
How to pass a count and sum value from one table to a not linked control in a form wi

Hello.


In Access 2013 I have 2 tables

tbAssembleias
tbEntities

The tbEntities, have a fiel called tbPresent (yes/no) to register the presents in a condominium meeting.


Table Name: tbEntities


Fields:


tbEntId...tbPresent (yes / no)..........tbVotes
1.........ye...........................5
2.........no...........................3
3.........yes..........................4
4.........no...........................6

In the form is the table tbAssembleias, but I want to put from the other table which is not present in the form:

1. a control that count how many are present (= yes)
Ex: Appearances 2
2. a control that sum the votes of those present
Ex: Votes 9
I already have a query that count how many are in the meeting, but cant realize how to pass the information to the field in the form...

This is the SQL view of the query with the real field names - and working:
SELECT Count(tbEntidades.tbAssPresente) AS ContaPresentes, tbEntidades.tbAssPresente
FROM tbEntidades
GROUP BY tbEntidades.tbAssPresente
HAVING (((Count(tbEntidades.tbAssPresente))=True) AND ((tbEntidades.tbAssPresente)=True));

Can somebody help with this?

Thanks.
Everterra.

Everterra is offline   Reply With Quote
Old 01-12-2015, 03:38 PM   #2
Everterra
Newly Registered User
 
Join Date: Jan 2015
Posts: 16
Thanks: 5
Thanked 0 Times in 0 Posts
Everterra is on a distinguished road
Re: How to pass a count and sum value from one table to a not linked control in a for

Ok, resolved

Using a listbox, >Properties >Source >Source line, and using there the Constructor, I mounted a query.


For the fist list box to show the Count, the result was:


SELECT Count(tbEntidades.tbAssPresente) AS ContaPresentes, tbEntidades.tbAssPresente
FROM tbEntidades
GROUP BY tbEntidades.tbAssPresente
HAVING (((Count(tbEntidades.tbAssPresente))=True) AND ((tbEntidades.tbAssPresente)=True));


For the second list box to show the Sum, the result was:


SELECT Sum(tbFrações.tbFrPerc) AS SomaDetbFrPerc, tbEntidades.tbAssPresente
FROM tbFrações
INNER JOIN tbEntidades ON tbFrações.tbFrId = tbEntidades.tbFrações.Value
GROUP BY tbEntidades.tbAssPresente
HAVING (((tbEntidades.tbAssPresente)=True));
Everterra is offline   Reply With Quote
Reply

Tags
count , sum

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pass table record count to Excel sumdumgai Modules & VBA 4 11-07-2012 05:17 PM
Pass unbound form control to query coasterman Queries 2 10-08-2012 12:27 AM
How to pass values to a WHERE clause from a form's control ysr3142 Forms 2 04-23-2012 01:57 AM
SQL on linked table vs SQL pass through darbid Queries 8 09-07-2011 12:42 AM
Pass a wildcard from a form control into a SUM query MLESCO Modules & VBA 1 01-27-2005 03:56 PM




All times are GMT -8. The time now is 03:37 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World