我正在 Microsoft Access 中处理一个学校项目,我有一个名为“成员”的表。该表中有一个名为 NoOfLessonsBooked 的字段。当会员总共预订了 10 节课程时,他们应该获得一节免费课程。我有另一个名为 Booking 的表,它存储所有已预订的详细信息。每次预订都包含进行预订的会员的会员 ID。我希望预订中包含会员 MemberID 的每条记录的 NoOfLessonsField 增加 1。因此,每次 MemberID 1 进行预订时,我希望 MemberID 1 在会员表中的记录将其 NoOfLessonsBooked 更新为 1。
这是有问题的 2 个表:
会员表
| MemberID | MemberForename | MemberSurname | MemberDOB | MemberAddress | MemberTown | MamberPostCode | MemberTelNo | MemberEmail | MemberMedCert | NoOfLessonsBooked |
|----------|----------------|---------------|-----------|---------------|------------|----------------|-------------|--------------------|---------------|-------------------|
| 1 | Reece | Agnew | 29-Oct-06 | SomeWhere 1 | SomeTown | ZX81 5PK | 0101 323656 | [email protected] | No | 1 |
| 2 | John | Hanna | 23-Dec-74 | SomeWhere 2 | SomeTown | ZX80 3CL | 102 323656 | [email protected] | No | 1 |
| 3 | Arthur | Marston | 13-Nov-58 | SomeWhere 3 | SomeTown | ZY1 2BC | 103 323656 | [email protected] | Yes | 0 |
| 4 | Bradley | Stone | 09-Aug-01 | SomeWhere 4 | SomeTown | ZX81 5PK | 104 323656 | [email protected] | No | 0 |
| 5 | Dawn | Pearson | 08-Mar-02 | SomeWhere 5 | SomeTown | ZX80 3CL | 105 323656 | [email protected] | No | 0 |
| 6 | Freya | Adams | 27-Feb-03 | SomeWhere 6 | SomeTown | ZY1 2BC | 106 323656 | [email protected] | No | 1 |
| 7 | Aurora | Bell | 24-May-12 | SomeWhere 7 | SomeTown | ZX81 5PK | 107 323656 | [email protected] | No | 2 |
| 8 | Mike | Graham | 12-Dec-56 | SomeWhere 8 | SomeTown | ZX80 3CL | 108 323656 | [email protected] | Yes | 0 |
| 9 | Jean | Marston | 17-Aug-60 | SomeWhere 9 | SomeTown | ZY1 2BC | 109 323656 | [email protected] | No | 1 |
| 10 | Iris | Chambers | 18-Oct-06 | SomeWhere 10 | SomeTown | ZX80 3CL | 110 323656 | [email protected] | No | 0 |
预订表
| BookingID | BookingDate | BookingTime | MemberID | ActivityID | GroupID |
|-----------|-------------|-------------|----------|------------|---------|
| 1 | 03-Oct-24 | 10:00 | 2 | 1 | |
| 2 | 07-Oct-24 | 11:00 | | 5 | 2 |
| 3 | 21-Oct-24 | 09:00 | 1 | 2 | |
| 4 | 29-Oct-24 | 13:00 | | 4 | 7 |
| 5 | 05-Nov-24 | 12:00 | | 3 | 3 |
| 6 | 13-Nov-24 | 11:00 | 9 | 1 | |
| 7 | 17-Nov-24 | 10:00 | | 4 | 2 |
| 8 | 20-Nov-24 | 15:00 | | 2 | 6 |
| 9 | 15-Dec-24 | 16:00 | 6 | 1 | |
| 10 | 22-Dec-24 | 13:00 | | 5 | 1 |
| 11 | 09-Oct-24 | 12:21 | 7 | 1 | |
| 12 | 26-Oct-24 | 13:00 | 7 | 2 | |
您可以在预订表上使用插入数据后宏来更新会员表