By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,474 Members | 1,270 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,474 IT Pros & Developers. It's quick & easy.

Getting totals for different entries in a field

P: 9
Please open the DDrive Doc to read my question. Thank you.
Attached Files
File Type: docx DDrive.docx (46.3 KB, 228 views)
Jan 28 '15 #1
Share this Question
Share on Google+
10 Replies


Rabbit
Expert Mod 10K+
P: 12,430
Please post your question in the thread itself. As a general rule of thumb, I do not open files from strangers.
Jan 28 '15 #2

P: 9
i have the field (incidenS)from a table. This field have different entries for each employee (collision, injury, inspection). i am trying to figure out a way to get a total for each entry (total collision, total injury, total inspection)for each employee, and put the individual totals in a form. I tried creating a query to add them up, but when i enter them on the form i get the word 'error' in its place.Some help/advise will be greatly appreciated. Thank you.

PS: I did create a query doing a count, that did give me totals for each (collision, injury, inspection), but i get the asme 'error' when i try to include it in the form.
Jan 30 '15 #3

Rabbit
Expert Mod 10K+
P: 12,430
Please show us the query.
Jan 30 '15 #4

P: 9
I am trying to copy/paste it but its not working, the paste option is grayed out
Feb 1 '15 #5

Rabbit
Expert Mod 10K+
P: 12,430
You can press ctrl+v to paste something that you've copied.
Feb 1 '15 #6

P: 9
I had already tried that (ctrl+c ctrl+v) and it did not work, I even try to copy/past using the snipping tool, but nothing seem to work.
Feb 1 '15 #7

P: 9
The only way that I can get it to copy/paste is to show it in SQL View which I am not to familiar with, If that will help you in anyway, the following is the SQL VIEW. Thank You.

SQL VIEW:

Expand|Select|Wrap|Line Numbers
  1. SELECT [Master Roster].Employee, [Master Roster].[Last Name], [Master Roster].[First Name], DisciplineT.Incidents, [Master Roster].[Adj Hire Date], [Master Roster].[Job Description], [Master Roster].[User Level], Count(DisciplineT.Incidents) AS [CountOfInjury/Collision/Roadside Inspection]
  2. FROM DisciplineT INNER JOIN [Master Roster] ON DisciplineT.[Employee #] = [Master Roster].Employee
  3. GROUP BY [Master Roster].Employee, [Master Roster].[Last Name], [Master Roster].[First Name], DisciplineT.Incidents, [Master Roster].[Adj Hire Date], [Master Roster].[Job Description], [Master Roster].[User Level]
  4. HAVING (((DisciplineT.Incidents)="collision" Or (DisciplineT.Incidents)="injury" Or (DisciplineT.Incidents)="Roadside Inspection"));
Feb 1 '15 #8

Rabbit
Expert Mod 10K+
P: 12,430
The SQL view is what I meant. You can't copy and past a query object into a text box. Also, please use code tags when posting code or formatted data.

What do you mean you get an error when you "put it on a form"? You mean you set the query as the row source and tried to set the control sources to the fields in the query? If the query runs, then using the query as a row source shouldn't pose any problems.

I did notice some potential issues with your naming convention though. It's best to avoid spaces and other special characters when naming a table or a field, they tend to cause more trouble than anything.

Also, I'm not sure why you're trying to do this in a form. It's usually better to do this type of summary information in a report because a form is for entering data whereas a report is for viewing data. This type of summary query can only be viewed and can not be edited from a form so it's odd that you would want to put it in a form.
Feb 2 '15 #9

P: 9
The user wanted a form instead. They wanted to enter an employee number and have the rest of the form populate. i already have a report and the totals show up as they should, but when i use the query to populat th form most of th records are not showing up. i am aware of the naming convention, but was trying to get the form to work first
Feb 3 '15 #10

Rabbit
Expert Mod 10K+
P: 12,430
You can do pretty much the same thing using a report.

How is the form set up? Are all the fields showing #ERROR#? Or just some, which ones? How are those fields set up? Is there any code running?
Feb 3 '15 #11

Post your reply

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