473,403 Members | 2,284 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,403 software developers and data experts.

Updating Data with a query

99 64KB
When I make a query in ms access in sql view using this code:
Expand|Select|Wrap|Line Numbers
  1. SELECT *
  2. FROM StudentsExams;
Data of the table may be updated by its datasheet view or a form based on it. However when I use a query:
Expand|Select|Wrap|Line Numbers
  1. SELECT (SELECT Count(*)
  2.      FROM StudentsExams As X
  3.      WHERE X.classid = StudentsExams.classid
  4. and x.PaperID = StudentsExams.PaperID
  5.         And X.Result > StudentsExams.Result)+1 AS Ranks, *
  6. FROM StudentsExams;
Data can not be updated.
Please what is the reason behind it and any alternate for it please?
Moreover when I create a report based on the 2nd query, multilevel grouping fails. Any help will be appreciated.
Another issue is: This query results in ranks as:
Expand|Select|Wrap|Line Numbers
  1. StudentID   ClassID     PaperID    Result    Rank
  2. 1          1         1        10        1
  3. 2          1         1        12        2
  4. 3          1         1        12        2
  5. 4          1         1        13        4
And the required ranking is as:
Expand|Select|Wrap|Line Numbers
  1. StudentID   ClassID     PaperID    Result    Rank
  2. 1          1         1        10        1
  3. 2          1         1        12        2
  4. 3          1         1        12        2
  5. 4          1         1        13        3
I shall be very thankfull for any solution.
Nov 21 '14 #1
3 986
jforbes
1,107 Expert 1GB
Lots of questions here...

Check out http://allenbrowne.com/ser-61.html for why your query isn't updatable.
An alternative would be to generate the Count in a Function and call it from your Form.

For Ranking, Rabbit has you covered: http://bytes.com/topic/access/insigh...-ms-access-sql

Using a function would probably fix your Reporting Grouping or it might start working after reading the stuff from Rabbit.
Nov 21 '14 #2
mshakeelattari
99 64KB
Ranking results the same condition from the code giben by Rabbit.

Please guide about the funciton for reporting grouping
Nov 22 '14 #3
Rabbit
12,516 Expert Mod 8TB
You already asked the ranking question in another thread and I responded in there.
Nov 23 '14 #4

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

Similar topics

3
by: 'bonehead | last post by:
Greetings, I'd like to figure out some syntax for retrieving the data from a table when I don't know all the of field names. What I do know are, the name of the table, the names of the primary...
3
by: Alan Payne | last post by:
First of all I don't normally use SQL, so please excuse my ignorance The following query Selects data based on another table. SELECT A.DSTRCT_CODE, A.WORK_ORDER, A.WO_TASK_NO, A.WO_TASK_DESC,...
6
by: Hasanain F. Esmail | last post by:
Hi all, I sincerly thank you all in advance for your help to solve this problem. I have been trying to find a solution to this problem for sometime now but have failed. I am working on a...
1
by: Kai Thorsrud | last post by:
Hi, I've only got a typical crappy Microsoft book about ADO.NET (MSPRESS !"(¤#&/()&¤# you for mixing manual written code and suddenly adding designtime controls and wizards for updating data) ...
34
by: Jeff | last post by:
For years I have been using VBA extensively for updating data to tables after processing. By this I mean if I had to do some intensive processing that resulted in data in temp tables, I would have...
2
by: marcmc | last post by:
Hey, I have never used a datagrid/dataset/adaptor/table method for updating data, I have always used direct updates to the database so ADO is quite new to me. I have a datagrid and I change a...
1
by: RookieDan | last post by:
Greetings fellow Accessers! Im new but in Access, but I have some background in different coding. I have a programme loading customer data into Access belonging to BMW dealers in Europe. ...
4
by: bobh | last post by:
Hi All, In AccessXP I create an Access table then create an update query which updates a field in that table with data from an SQLServer table and when I run it I get the message 'operation...
7
by: billelev | last post by:
I have a query that selects data based on a particular date. This date is selected from a combo box on a form. The data from the query is then used to generate a report. This report can be...
1
by: Neha1184 | last post by:
When I link an Excel table to access and run query then a new table is created just fine. But if i run the query again i get an error"Numeric Field Overflow". If i open the query in design view and...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.