Mike said:
You would have to add the job number as a separate field but could
concatenate it in a query.
I would use an auto number for the proposal in this case. You could
use MoveLast and get the last proposal number and add 1 to it or
maintain that number in a separate table. (Buy Access Developers
handbook and use their code.)
There are trade offs in any case.
Because of the unpredictability of Autonumber values, perhaps this
might not be too good an idea!
Autonumber is designed only to provide a unique identifier for records
in a table. This is used internally by Access in building relationships
between tables according to your design. The actual values that
Autonumber delivers are unimportant and should never be exposed to
users or have any external meaning at all. Depending on the design and
use of the database, Autonumber will develop gaps, become
random and go negative.
For any number series that you want to control or have available
externally, you must design your own. There are several schemes
available depending on what you want to do.
Here is some code to generate sequential numbers. It works for both
single and multi-user scenarii.
You will need a new separate Table (tblSeries) having just one Field
(NextNumber) of type Long Integer to store the incrementing number.
The Table will have no index and will not be related to any other Table.
Dim rst As Recordset, db As Database
Dim lngNextNumber As Long
Set db = CurrentDb
'Open tblSeries, lock, read next number, increment, update and unlock.
Set rst = db.OpenRecordset("tblSeries", , dbDenyRead)
With rst
.MoveFirst
.Edit
lngNextNumber = ![NextNumber]
![NextNumber] = lngNextNumber + 1
.Update
End With
rst.Close
Set db = Nothing
This code is designed for Access 97. If you are using a later version,
you will need to use DAO.Recordset and DAO.Database and make sure you
have the appropriate reference set for the DAO Library.
The incrementing number is returned to you in the variable
lngNextNumber.
This code should be in the Click event of the command button you use
finally to commit your numbered record. This must happen after all
opportunities to abort your record, otherwise you could have gaps in
your numbering to explain to your auditors! After this code, you will
need to store the number value in your Table holding your records.
If, in your system, you need other unrelated number series, just add
another Field to tblSeries and manage it in a similar manner.
hth
Hugh
hth
Hugh