Last piece of coding...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Sorry to post again. I must complete this database for tommorow and am
getting frustrated, as I am evidently so bad at VBA.

This is very simple:

I have 1 Table made for a school. One of the fields, has the
"YearGroupOfStudent". Either 7, 8, 9, 10

I need to make the database so that on July 31st each year, the database will:

Change the data in field "yeargroup" from "7" to "8"
Change the data in field "yeargroup" from "8" to "9"
Delete all records with "10" in the field yeargroup.

Can anyone supply me with the coding for this?

I will be extremely grateful, at this stage, for any help I can get...

Thanks..
 
Assuming table name is TABLE1 (or change table1 name to what ever your table
name is).
Run these in order given:


DELETE Table1.YearGroupOfStudent
FROM Table1
WHERE (((Table1.YearGroupOfStudent)=10));


UPDATE Table1 SET Table1.YearGroupOfStudent = 10
WHERE (((Table1.YearGroupOfStudent)=9));

UPDATE Table1 SET Table1.YearGroupOfStudent = 9
WHERE (((Table1.YearGroupOfStudent)=8));

UPDATE Table1 SET Table1.YearGroupOfStudent = 8
WHERE (((Table1.YearGroupOfStudent)=7));
 
I forgot to note, however, that changing the data in the tables isn't the
most desired thing to do. What could have been done is to have dates of
their start year stored in the table instead of yearGroup. Using query or
report display which year each student is in.

M.Afzal
 
Back
Top