How to generate sequentially numbered vouchers ?

G

Guest

Hi,
As tours are sold at the various hotels, we need to provide "vouchers" to
the customers which they will give to various service providers during the
tour. We want to number these vouchers with sequential and unique numbers.

Initally I thought of a table of vouchers with an autonumber primary key
(VoucherNo), new records being added by "Append query", BUT, looking through
this forum's postings, I was discouraged from using Autonumber. Also,
wouldn't I have contention problems for voucher numbers when many hotels
started printing vouchers at the same time ?

Also I couldn't get an Append query to add rows to the Voucher Table, using
the autonumber primary key.

Comments and ideas for general approach, will be greatly appreciated.
TIA,
Charlie
 
D

Dirk Goldgar

Charlie said:
Hi,
As tours are sold at the various hotels, we need to provide
"vouchers" to the customers which they will give to various service
providers during the tour. We want to number these vouchers with
sequential and unique numbers.

Initally I thought of a table of vouchers with an autonumber primary
key (VoucherNo), new records being added by "Append query", BUT,
looking through this forum's postings, I was discouraged from using
Autonumber. Also, wouldn't I have contention problems for voucher
numbers when many hotels started printing vouchers at the same time ?

Also I couldn't get an Append query to add rows to the Voucher Table,
using the autonumber primary key.

Comments and ideas for general approach, will be greatly appreciated.
TIA,
Charlie

Are the hotels networked together to use the same back-end database?
How do the hotels interact with the database? The general solution to
this sort of problem is to have a one-record table in the back-end
database that stored the next available voucher-number, and have a
routine that gets a voucher number by: (1) opening a recordset on the
table and locking it in the process, (2) getting the next
voucher-number, (3) incrementing the voucher-number field in the
recordset and updating the record, and (4) closing the recordset,
releasing the lock. This routine would be called at the last possible
moment in generating each voucher so as to avoid "losing" any voucher
numbers.

If the hotels aren't all interacting in real time with the same back-end
database, though, this scheme won't work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top