FormSubform.mdb (beginner) |
Post Reply |
Author | |
Roger Carlson
Microsoft MVP Joined: 20 Feb 2008 Status: Offline Points: 261 |
Post Options
Thanks(0)
Posted: 01 Aug 2008 at 4:23am |
Please consider donating $1 per sample downloaded, find out why here.
FormSubform.mdb This form illustrates how to use Domain functions to do a variety of tasks in a Form/Subform situation.
1. DMax is used to obtain the next number for ProductID similar to how the autonumber works. =DMax("ProductID","Product")+1 in the default value of ProductID. 2. DMax is used with the query "qryPartNo" to obtain the next PartID for that particular ProductID. The NZ function converts a null value to zero. This is for the case when there are no part numbers for that product yet. The DMax returns Null, the NZ converts to zero, and then 1 is added to it. me!PartID =nz(DMax("PartID","qryPartNo"))+1. This is placed in the BeforeInsert event of the Form. The event also checks to see if the PartID is zero (0) before changing PartID. 3. DFirst is used with the Totals query "qrySumPrice" to find the sum of the Part prices for that ProductID. =DFirst("SumOfPrice","qrySumPrice") |
|
|
|
Sponsored Links | Want a good read? Try The Summer of His Life (available on Amazon!) |
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |