Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DMAX and Subforms

Status
Not open for further replies.

MDDNRBrian

Technical User
Jun 17, 2003
2
US
Hi. I'm having trouble figuring out what code to use in my subform to create an incremental variable "Tag Number" as records are added. I've tried DMAX and DLAST but can't get it to do exactly what I need.

What I have is a mainform with owner info (Permit #, name, address, etc.). I then have a subform linked by permit # that I enter individual tag information into (one to many relationship). My problem is, I need to be able to enter a number value in the Tag # column of the first subform record for a given owner, and then have Access automatically fill in Tag # + 1 as I tab through additional subform records for the given owner. Tag number series are assigned randomly for a given owner (i.e., Owner 1 may be assigned Tag 1 - Tag 50; Owner 2 may be assigned Tag 555-675, etc.).

I tried DMAX code in the default value property box, but it was acting strangely. For example, I'd enter 551 in the first record, then it would make the next 2 records 552, the next 2 records, 553, etc. Plus, it's not gauranteed that my tag numbers will be larger from one owner to the next. In other words, owner 1 may have a larger series of tags then owner 2. Essentially, I need some way to only look at the subform data for a given owner and have the Tag # + 1 process work within that owners data. Thanks for any help that can be provided. Brian
 
Certainly you have heard of setting the tag number field to AutoNumber instead of Number? This automatically increments when new records are added.

Take care,
--Shaun

"I wish that my room had a floor; I don't care so much for a door.
But this crawling around without touching the ground is getting to be quite a bore!" -- Gelett Burgess
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top