Autonumbering within a replicated set

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

Guest

I have used the autonumber feature to create an individual number for each
order or quote received. Since replication this feature makes keeping track
quite difficult and the numbers very long.

Is there an expression that can be used either within a query or in a table
that could create a new number for each new saved record. It would not be
unique but that is not an issue.

Many thank in advance for your assis
 
I have used the autonumber feature to create an individual number for each
order or quote received. Since replication this feature makes keeping track
quite difficult and the numbers very long.

Is there an expression that can be used either within a query or in a table
that could create a new number for each new saved record. It would not be
unique but that is not an issue.

It's easiest to do on a Form; in the Form's BeforeInsert event put
code like

Private Sub Form_BeforeInsert(Cancel as Integer)
Me!txtSeqNo = NZ(DMax("[SeqNo]", "[tablename]", "[OrderID] = " _
& Me!txtOrderID)) + 1
End Sub

This assumes that there is a (random) autonumber field OrderID, and
that you don't mind different orders having the same SeqNo (which will
be fun when you synchronize the replicas!)


John W. Vinson[MVP]
 
Thank you John,

The orders will be put through on one replica set for now but ideally the
numbers need to be sequential and different for each order - any ideas

Charlie

John Vinson said:
I have used the autonumber feature to create an individual number for each
order or quote received. Since replication this feature makes keeping track
quite difficult and the numbers very long.

Is there an expression that can be used either within a query or in a table
that could create a new number for each new saved record. It would not be
unique but that is not an issue.

It's easiest to do on a Form; in the Form's BeforeInsert event put
code like

Private Sub Form_BeforeInsert(Cancel as Integer)
Me!txtSeqNo = NZ(DMax("[SeqNo]", "[tablename]", "[OrderID] = " _
& Me!txtOrderID)) + 1
End Sub

This assumes that there is a (random) autonumber field OrderID, and
that you don't mind different orders having the same SeqNo (which will
be fun when you synchronize the replicas!)


John W. Vinson[MVP]
 
Thank you John,

The orders will be put through on one replica set for now but ideally the
numbers need to be sequential and different for each order - any ideas

Those are contradictory requirements.

If they are to be sequential, each replica must know what numbers have
been assigned by the other replicas. Think about it: if you were doing
it on paper, and you had one clerk in Boston, a second in Dallas, and
a third in Singapore assigning order numbers, without communicating
with one another, how would you arrange to have the numbers
sequential?

I guess I don't understand your question!

John W. Vinson[MVP]
 
Back
Top