Let me start by suggesting you don't confuse an ID field with a sequencing one. It will often work that way if required but it isn't designed to so to rely on that is unwise.
Having said that you will need a sequencing field as well as a flag to indicate which record is next to be used. There may be some SQL that will do both jobs for you smoothly (IE. Clearing one record as well as setting the next.) but as Jet SQL has so many limitations that make a query non-updatable it's so much more straightforward to use recordset code in VBA to make the updates.
The Form Control would be set with a DefaultValue in the relevant Field (Your explanation talks of two tables but then gives an example of SQL referring to a table with a completely different name.) to match the value from the record with the flag set. This would be updated only after the record has actually been created though. You don't want to create gaps when a record is started but never saved.
The code would be something like :
- Dim lngSequence As Long
-
Dim strSQL As String
-
Dim dbVar As DAO.Database
-
-
lngSequence = DLookup(Expr:="[SequenceField]" _
-
, Domain:="[YourTable]" _
-
, Criteria:="([NextFlag])")
-
Set dbVar = CurrentDb()
-
strSQL = Replace("SELECT TOP 2%L" _
-
& " , [SequenceField]%L" _
-
& " , [NextFlag]%L" _
-
& "FROM [YourTable]%L" _
-
& "WHERE (Not [Archive])%L" _
-
& " AND ([SequenceField]>=%V)%L" _
-
& "ORDER BY [SequenceField]" _
-
, "%L", vbNewLine)
-
strSQL = Replace(strSQL, "%V", lngSequence)
-
With dbVar.OpenRecordset(Name:=strSQL, Type:=dbOpenDynaset)
-
Call .Edit
-
!NextFlag = False
-
Call .Update
-
Call .MoveNext
-
Call .Edit
-
!NextFlag = True
-
Call .Update
-
Call .Close
-
End With