G
Gary Schuldt
I'm dealing with displaying / modifying data that describes a subtype, and
my question has to do with a pattern that occurs in such situations.
The application deals with tracking information about (botanical) plants.
Table tPlant contains genus/species/variety/commonName info common to all
plants. tPlantID is the PK for such records.
Some plants in tPlant also belong to a subtype of interest--e.g., Rhody,
Conifer, Heather. Each subtype has its own particular attributes--i.e., the
fields in tPlantRhody are those used by the Rhody afficionadi to describe
rhodies and do not apply to Conifers. There'd be another table
tPlantConifer, etc. tPlantID is the PK for all these subtype tables.
The question is coming!
Say the form frmPlant is being displayed, and it includes a drop-down list
of all the subtype names (Rhody, Heather, Grass, etc). If the user clicks
on one of those list items, I want to popup the corresponding form for that
type, displaying the subtype record whose PK = tPlantID from frmPlant.
Problem is that that particular record may not exist, either because a new
tPlant record is being created or because the subtype info wasn't supplied
by the user when it was created.
Can I just open the subtype form (e.g., frmPlantRhody) and trust Access to
determine whether it's in Add or Edit mode, depending on the existence of
the tPlantID in tPlantRhody? Or do I have to include code to test for that
condition and use two OpenForm statements with different modes?
Since this could happen in any supertype / subtype situation, the solution
will definitely be reusable!
Gary
I have the I'm just not sure which "mode" to
my question has to do with a pattern that occurs in such situations.
The application deals with tracking information about (botanical) plants.
Table tPlant contains genus/species/variety/commonName info common to all
plants. tPlantID is the PK for such records.
Some plants in tPlant also belong to a subtype of interest--e.g., Rhody,
Conifer, Heather. Each subtype has its own particular attributes--i.e., the
fields in tPlantRhody are those used by the Rhody afficionadi to describe
rhodies and do not apply to Conifers. There'd be another table
tPlantConifer, etc. tPlantID is the PK for all these subtype tables.
The question is coming!
Say the form frmPlant is being displayed, and it includes a drop-down list
of all the subtype names (Rhody, Heather, Grass, etc). If the user clicks
on one of those list items, I want to popup the corresponding form for that
type, displaying the subtype record whose PK = tPlantID from frmPlant.
Problem is that that particular record may not exist, either because a new
tPlant record is being created or because the subtype info wasn't supplied
by the user when it was created.
Can I just open the subtype form (e.g., frmPlantRhody) and trust Access to
determine whether it's in Add or Edit mode, depending on the existence of
the tPlantID in tPlantRhody? Or do I have to include code to test for that
condition and use two OpenForm statements with different modes?
Since this could happen in any supertype / subtype situation, the solution
will definitely be reusable!
Gary
I have the I'm just not sure which "mode" to