Print Page | Close Window

FormSubform.mdb (beginner)

Printed From: Roger's Access Library
Category: Roger's Access Library
Forum Name: Roger's Download Samples
Forum Description: A compendium of Microsoft Access 97 and 2000+ routines, each separated into its own sample database.
Printed Date: 10 Jul 2020 at 8:22pm
Software Version: Web Wiz Forums 12.03 -

Topic: FormSubform.mdb (beginner)
Posted By: Roger Carlson
Subject: FormSubform.mdb (beginner)
Date Posted: 01 Aug 2008 at 4:23am

Please consider donating $1 per sample downloaded, - find out why here .


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")
Access 97 (26 KB): - uploads/5/
Access 2000 (40 KB): - uploads/5/

Consider donating $1 per sample downloaded," rel="nofollow - find out why here .<

Print Page | Close Window

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