Sub form autonumber

haroon.mansha

Registered User.
Local time
Today, 19:25
Joined
Jun 6, 2013
Messages
106
Hi all
I have invoice with number as master form. In sub form table I want sr.no for all records and I want it to be reset with next master record

Can any body give idea how I can do it

Example as follow
Invoice 1
1. Apple
2.banana

Invoice 2
1.banana
2.apple
 
What is sr.no ? And what do you mean by reset? Reset to what?
You already have a Invoice Number on the main form?
What else do you need on the subform?
 
You can say like line number
 
As in a Primary Key for a counter? Please a little clearer!
 
It is not primary key. Its just a line number and I want it to reset at every new record
 
You did not what type it is, a number or what? If it is a number then you can reset it as you say to whatever you want by simply using a DMax statement.
Example:
UniqueNumber = Nz(DMax("UniqueNumber", "tblTest") + 1) 'Increment Number By One.
Me.Dirty = False

HTH
 
Its a number. User will not put anything in it. It should be like autonumber
 
Reset to what? You have it as a autonumber which counts and advances by one!
What value should it have to start with and then what value should the next one be?

I don't understand.
 
First, you need to create a subform for your sales details, then make ItemSerial a number in your table. Then use a AfterUpdateEvent to set it back to 1.


See Attached Revision.

HTH
 
Last edited:
Thanks for helping.

For Each Invoice i want the Item serial number to be 1. for example

Invoice no . 1 (master form)

invoice details subform

serial no Product Quantity Price Total
1 Apple 1 2 2
2 Banana 5 5 25
3 Orange 10 5 50
4 Cocunut 20 1 20


for invoice number 2 (master form)

invoice details (sub form) and i want this serial number to be reset to 1
serial no Product Quantity Price Total
1 Orange 3 2 6
2 Banana 4 2 8
3
....
....


with next invoice this subform serial number to change again to 1

HOpe you understand my point. Thanks again
 
NO, I don't understand. The example I gave you sets the Itemserial number back to 1.
There is NO Serial Number, only a Itemserial. Please take a look at what I gave you and add a product on the subform.

???
 
In my example serialno meant to itemserial no which is suppose to autonumber and with each invoice reset to 1
 
Just like you buy something from store all items are like 1, 2,3 etc. When there is new invoice they make there is once again sequence 1,2,3...
 
I guess you downloaded the db or else someone else did.
Good Luck With Your Project!
 
Thanks for your help
Infact when I visit to download file there was no link,

but I found a solution by count function
 

Users who are viewing this thread

Back
Top Bottom