Discussion Locked

Access Programming

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

In my access database I have a form with a subform.
This subform is used to enter multiple lines of data and ofcourse is all stored in various tables.

I want each line in my subform to show an item number, starting at 1 and increasing by 1 each line and the item number to be stored for later use in my tables.

When a new form is started, I need the item number in the subform to always start at one.

This is probably easy, and i have done it in the past, but am mentally blocked today.

3 replies

by sivasankaran

you have to create the tables with main table as primary key say anum(autonumber) and the sub table as same field (anum as long number ) but should allow duplicates. in the relationships make it one to many . now using the wizard you can make a form and subform with multiple records. but anum will auto increment so in the sub table create a field storing the count of anum. at evry new record event on form put count anum +1 to new field say sno so for first rec dcount (anum, tablename) = 0 +1 =1 and so on .

This discussion is closed to new replies.