Custom Autonumber Field

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

Guest

Hi!

I have DeliveriInformationTable which includes field

DeliveryAgreement#(PK
DeliveryDate---This is set to current dat
DeliveryCharge
HandlingCharge
TotalInvoiceAmou
Invoice

I have built a form based on the above table. What I am looking for is to have the same Invoice number for the Delivery information entered on the same date

If I enter 10 delivery information, all those 10 must have the same invoice number in a format like "CurrentYear""0000". It must start at the above format. If it was next year again it must start at "CurrentYear""0000"

Is it possible to do

Any hel

Thank
Va
 
Yes, it's possible, but you must do it in the form. You can can calculate
the next sequential value using DMax. Add that to the result of the Year
function:

InvoiceNumber = Year & DMax(...)

You can put that in the BeforeUpdate event of the Form.

By the way, it would be better to get rid of the hash marks in your field
names -- they're reserved characters in VBA and can cause you prolblems down
the road.

HTH

--
Rebecca Riordan, MVP

Designing Relational Database Systems
Microsoft SQL Server 2000 Programming Step by Step
Microsoft ADO.NET Step by Step

http://www.microsoft.com/mspress

Blessed are they who can laugh at themselves,
for they shall never cease to be amused...

vad said:
Hi!

I have DeliveriInformationTable which includes fields

DeliveryAgreement#(PK)
DeliveryDate---This is set to current date
DeliveryCharges
HandlingCharges
TotalInvoiceAmout
Invoice#

I have built a form based on the above table. What I am looking for is to
have the same Invoice number for the Delivery information entered on the
same date.
If I enter 10 delivery information, all those 10 must have the same
invoice number in a format like "CurrentYear""0000". It must start at the
above format. If it was next year again it must start at
"CurrentYear""0000".
 
Back
Top