Solved How to format ascending numbers for different inputs?

here test this.
BTW your LotNumber on the form has LotNumver as it's Name, so i used LotNumver in the code.
Edit the PurchaseDate for the code to get triggered.
 

Attachments

here test this.
BTW your LotNumber on the form has LotNumver as it's Name, so i used LotNumver in the code.
Edit the PurchaseDate for the code to get triggered.
I changed it to LotNumber :D

It still starts from 01 for every new date.
But also I cancelled the Locked function because if I get ingredients from other suppliers I need to put their lot numbers.
 
see the db i attached and change it there. also if you change it to LotNumber, change also the LotNumver on the code.
 
is not this what you need?
in the code you put Date, not DateofPurchase

so as it happens all the inputs you gave have the same date (today) and they go ascending. Try using another date (if you choose a future date it will work) and you will see it goes to 01
 
download the db i posted and see it your self.
I did and checkd it on your db

1728730895571.png
 
that is not what i uploaded, my LotNumber is based on Today's date and Not on PurchaseDate.
I know. I changed it

but I tried it with the date first and it still has the same problem. if you choose another (future) date, it goes back to 01
 
Try this update.
The fact remains that the database is quite poorly made, suffice it to say that in the LotNumberF mask by not inserting the date or inserting a date after today's the record is still saved, etc...
 

Attachments

Try this update.
The fact remains that the database is quite poorly made, suffice it to say that in the LotNumberF mask by not inserting the date or inserting a date after today's the record is still saved, etc...
wow you fixed it!!

but it's too advanced for me to understand what you did. can you explain it so I can learn?
 
wow you fixed it!!
how will you deal if your Last LotNumber is from your customer LotNumber (manual entry)?
then you enter new record it will find this LotNumber (as the last record) and try to Add 1 to it?
worst the Last 2 characters are not Number, so CInt() will fail to this and you will get runtime error.
 
how will you deal if your Last LotNumber is from your customer LotNumber (manual entry)?
then you enter new record it will find this LotNumber (as the last record) and try to Add 1 to it?
worst the Last 2 characters are not Number, so CInt() will fail to this and you will get runtime error.
oh I didn't think about that.
I will input the lot from other suppliers manually yeah, since they don't match my system.
heck, I don't know what's the best solution here.
what do you suggest is the best choice?
 
When you create the supplier you have to say if the lot should be automatic or manual, once you do this you block or not the txtLotNumber control depending on your choice.
 

Users who are viewing this thread

Back
Top Bottom