adhoustonj
Member
- Local time
- Today, 09:27
- Joined
- Sep 23, 2022
- Messages
- 192
Hey AWF,
I'm wondering how I can cycle through a set number of lets say 10 seats numbered 1-10, with 10 alphabetic names of A:J, and they are left to right.
In this case, people will shift a seat to the right, but not everyone, and I need to record their new seat number.
Is there an efficient way to do this for the below desired station_after_move compared to station_id?
I feel I need to walk a recordset with something like...
So for the code below: I'm struggling because what if I had 4 & 5 as no_move... Do i Just need to do a count and then walk backwards and also count if multiple no_moves are in a row?
I'm wondering how I can cycle through a set number of lets say 10 seats numbered 1-10, with 10 alphabetic names of A:J, and they are left to right.
In this case, people will shift a seat to the right, but not everyone, and I need to record their new seat number.
Is there an efficient way to do this for the below desired station_after_move compared to station_id?
I feel I need to walk a recordset with something like...
Code:
Private Sub ReOrderStationAssignments()
Dim last as Integer
Dim lastlast as Integer
strSQL = "SELECT station_id, person, order, move, station_after_move FROM tblStationPerson"
set rs = db.openRecordset(strSQL)
with rs
.movefirst
if .EOF = False Then
if .move & "" = "" Then
last = .order + 1
lastlast= .order
Else
.moveNext
So for the code below: I'm struggling because what if I had 4 & 5 as no_move... Do i Just need to do a count and then walk backwards and also count if multiple no_moves are in a row?
station_id | person | order | no_move | station_after_move |
1 | A | 1 | X | 1 |
2 | B | 2 | 3 | |
3 | C | 3 | 4 | |
4 | D | 4 | 2 | |
5 | E | 5 | X | 5 |
Last edited: