Roger's Access Library Homepage
Forum Home Forum Home > Roger's Access Library > Roger's Download Samples
  New Posts New Posts RSS Feed - FormSubform.mdb (beginner)
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

>
Want a good read? Try The Summer of His Life (available on Amazon!)

FormSubform.mdb (beginner)

 Post Reply Post Reply
Author
Message Reverse Sort Order
Roger Carlson View Drop Down
Microsoft MVP
Microsoft MVP


Joined: 20 Feb 2008
Status: Offline
Points: 261
Post Options Post Options   Thanks (0) Thanks(0)   Quote Roger Carlson Quote  Post ReplyReply Direct Link To This Post Topic: FormSubform.mdb (beginner)
    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")
 
Download
Access 97 (26 KB):
uploads/5/FormSubform97.zip
Access 2000 (40 KB): uploads/5/FormSubform2k.zip

Consider donating $1 per sample downloaded, find out why here.<
Back to Top
Sponsored Links
>
Want a good read? Try The Summer of His Life (available on Amazon!)

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.03
Copyright ©2001-2019 Web Wiz Ltd.