Click here to Skip to main content
15,895,557 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
I am doing some university coursework, and i have created a query to extract some data from the database but i keep receiving the error 'the field is too small to accept the amount of data...' and i have no clue what i have done wrong.

Here is what i have written:
SQL
SELECT SMM.StudentId, Student_Module.YearStudied, AVG(SMM.FinalMark) AS AverageMarks
FROM SMM, Student_Module, Student
WHERE Student.StudentId=SMM.StudentId
AND SMM.StudentId=Student_Module.StudentId
AND SMM.ModuleCode=Student_Module.ModuleCode
AND Student_Module.ModuleCode=Module.ModuleCode
AND Student.GraduationDate="09/08/2013"
AND YearStudied>1
GROUP BY SMM.StudentId, YearStudied; 

UNION SELECT SMM.StudentId, "DegreeResult" AS YearStudied, AVG( SMM.FinalMark) AS AverageMarks
FROM SMM, Student_Module, Student
WHERE Student.StudentId=SMM.StudentId
AND SMM.StudentId=Student_Module.StudentId
AND SMM.ModuleCode=Student_Module.ModuleCode
AND Student_Module.ModuleCode=Module.ModuleCode
AND Student.GraduationDate="09/08/2013"
AND YearStudied>1
GROUP BY SMM.StudentId;

When i go to the 'StudentModule' and change the data type in 'YearStudied' to text the error changes to 'Data Type Mismatch'
Any help would be much appreciated (P.S I am a beginner on Access)

[Edit member="Tadit"]
Added pre tags.
[/Edit]
Posted
v2
Comments
[no name] 11-May-14 18:24pm    
http://www.google.com/search?q=the+field+is+too+small+to+accept+the+amount+of+data
CPallini 12-May-14 4:07am    
What field? Could you please provide more info?

Quote:
You could have an Integer field where the incoming data is larger, or a text field with a small width where the incoming text is longer, or that type of thing. You might be able to find it by eliminating fields one at a time until you find the offending one, or start with one safe field and start adding fields until you find the bad one.
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900