Solved Auto fill serial number in subform

theinviter

Registered User.
Local time
Today, 15:45
Joined
Aug 14, 2014
Messages
273
Dears;
I have created a form "Clinic" and sub from "Delivery_Number" , there is a field named "Delivery" , user update "Delivery_Date"
so I want this field "Delivery" to auto update with serial number starting from (one) after updating "Delivery_Date".
repeat the cycle with every new record in main form.

anu advise.

thanks
 
In the forms Update event, you could use DMax() function to get the last used number, add 1 to it and save the result in the appropriate field.
 
In the forms Update event, you could use DMax() function to get the last used number, add 1 to it and save the result in the appropriate field.
Just a further thought. You would need to make sure that the field has not already got a value before assigning the value, otherwise editing an existing record would cause the number to be altered.
 
Just a further thought. You would need to make sure that the field has not already got a value before assigning the value, otherwise editing an existing record would cause the number to be altered.
thanks
but what if a new record in subform has a new ID of main form, then wanna cycle start again from one .
 
Here's a sample that shows two types of custom sequence numbers. You want the type in the form to the right which is a subform.

 
Are you attempting to create a CHILD record number that is unique for a given parent record? Or was it the PARENT record that needs to be numbered specially? Or both?
 
Done,
i did as the code below, worked fine.
If Me.Delivery = 0 Then
Delivery = Nz(DMax("Delivery", "PO_Date", " Link_ID = " & Forms!Data_Entry!ID), 0) + 1
Else
End If
 

Users who are viewing this thread

Back
Top Bottom