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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calculate new record value from older records

Status
Not open for further replies.

rjpeters

Programmer
Jul 17, 2001
5
AU
simple db holding cd details.
main form holds cd title etc
subform holds tracks, has fields [TrackNo] & [TrackCount]
when I make new record I want to set TrackNo to previous TrackNo+TrackCount (will worry about validating that does not already exist afterwards)
Should not be hard to do but work it out! (mental block or just mental)
Using Access97.
Any help appreciated
- R. Peters
 
use DMax function to find the maximum value and add 1 to it.
say the subform is based on a table named CDtracks with fields (cdID,TrackNum,TrackName...) then using
DMax("TrackNum","CDtracks","cdID=" & txtcdID) will return the highest value in TrackNum - to which you can add 1 and assign to the new record
good luck,
Erez.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top