Results 1 to 8 of 8
  1. #1
    Khan is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2022
    Posts
    12

    Update the linked record to next record (Students promoted to next class)

    Hi guys!



    I have student and class databases, at the end of session students are transferred to next class, so an update is needed to change class to next class in student database from Class database

    Student.ClassID is linked to Class.ClassID to show Class Name.

    Now I want an update Query to update all records to next class.

    I tried Class.ClassID+1, it displays the next class but how to update the same in student.classid.

    Thanks in advance for any help.
    Regards
    Khan

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,906
    I sure you mean tables and not databases

    Just run an update query adding 1 to student.classid, except for the last class, going by your description
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    Khan is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2022
    Posts
    12
    Quote Originally Posted by Welshgasman View Post
    I sure you mean tables and not databases
    You are right, my mistake.

    Quote Originally Posted by Welshgasman View Post
    Just run an update query adding 1 to student.classid, except for the last class, going by your description
    I did it but it says Query not updatable.
    I will share the screenshot here.

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,973
    You may need to specify unique records as you have a one to many join.
    Try changing the query SQL to start with UPDATE DISTINCTROW ...
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #5
    Khan is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2022
    Posts
    12
    How to avoid updating last Class?
    It's updating all but for the last class (that cannot be updated) it's giving error.

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,906
    Quote Originally Posted by Khan View Post
    How to avoid updating last Class?
    It's updating all but for the last class (that cannot be updated) it's giving error.
    Test for last class?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  7. #7
    Khan is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2022
    Posts
    12
    Quote Originally Posted by Welshgasman View Post
    I sure you mean tables and not databases

    Just run an update query adding 1 to student.classid, except for the last class, going by your description
    How can I avoid updating Last Class???

    For the time being, I have added LEFT SCHOOL after EIGHT class but that's not the solution, if I have to add more classes.

    Hope you can suggest something workable.

  8. #8
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,906
    Well presumably the Class has a number and you are incrementing that?
    So only do so for Classes where their number is less than Max(Class) - 1 ?

    Simple math really?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Access query to promote students to next class
    By erickemboi in forum Access
    Replies: 63
    Last Post: 01-27-2022, 12:09 PM
  2. Replies: 9
    Last Post: 12-08-2021, 02:40 AM
  3. Replies: 4
    Last Post: 02-06-2017, 03:29 AM
  4. Replies: 1
    Last Post: 11-23-2016, 07:42 PM
  5. Replies: 2
    Last Post: 07-25-2016, 08:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums