Dan,
Checking that I'm understanding your setup.
The bolt length on the main form can either be from the list of
FlangetoFlangeBoltLength in tblBoltMaterials
OR
The user can type in a different value?
If the above is correct, I suggest an additional field for bolt length like
so:
FlangetoFlangeBoltLength
OtherBoltLength
FlangetoFlangeBoltLength comes from tblBoltMaterials which is related
one-to-many to tblBoltGasketTakeoff
OtherBoltLength is not related to tblBoltMaterials
Your code would make sure that a user could enter either a
FlangetoFlangeBoltLength or OtherBoltLength but not both.
The FlangetoFlangeBoltLength would be chosen from a combo on the main form
which would add the ID from tblBoltMaterials,
but there is not a related table for OtherBoltLength.
I'm going to suggest a slight change to the way the tables are set up. I
don't know anything else about your app. If the table descriptions you sent
in the last post are the only table in your app, then the changes I outline
below would fit OK, but if you have several other tables, then maybe we need
to look at them all.
I'm not happy about the structure of the tables. The
FlangetoFlangeBoltLength looks as though it should be in a separate Lookup
Table, the PipeSize looks as though it should be in a separate Lookup Table
which populates a combo on the main form and the BoltDiameter looks as
though it should be in a separate Lookup Table which populates a combo on
the main form. That leaves BoltQty to be put in tblBoltGasketTakeoff as a
field.
In other words replace tblBoltMaterials with 3 separate lookup tables and
move BoltQty into tblBoltGasketTakeoff .
tblGasketMaterials looks OK as does tblISO
I suggest that PipeSpec and GasketType are also separate lookukp tables with
combos on the main form (unless PipeSpec and GasketType can be selected as a
pair because the same PipeSpec always goes with a particular GasketType) .
That removes both subforms from the main form.
Jeanette Cunningham
dancox via AccessMonster.com said:
This is my table structure.
tblBoltGasketTakeoff
PK IDBoltGasketTakeoff
IDBolts
IDGasket
FlangeQty
BoltLength
IDISO
FlangetoFlange Yes/No
tblBoltMaterials
PK IDBolt
PipeSize
BoltQty
BoltDiameter
FlangetoFlangeBoltLength
tblGasketMaterials
PK IDGasket
PipeSpec
GasketType
tblISO
PK IDISO
ISONumber
The Main Form is based on tblBoltGasketTakeoff. Subforms are based and
tblGasketMaterials and tblBoltMaterials. By selecting the PipeSpec on the
main form based on control source IDGasket. The subform populates the
corresponding gasket materials. The next selection is PipeSize based on
the
IDBolts PipeSize field. The subform populates with Diameter and Quanitity
of
bolts. On the main form I also want Bolt Length. The bolt length comes
from
tblBoltMaterials for a FlangetoFlange connection, but if it is not a
FlangetoFlange to connection, then the user has to be prompted to enter a
custom value from a list or type in their own value.
Jeanette said:
Dan,
I'm not sure what your form is trying to do, but your process sounds
back-to-front.
Normally the main form is the parent and a value on the parent is used to
set a default on the child (subform).
You are asking for the opposite - I don't know if it is do-able.
Post some more details:
--form - table, primary key, foreign key, any other significant fields
--same for subform
--explain how the default value will be used on the main form.
Jeanette Cunningham
I have a bolt takeoff form based on a bolt takeoff table.
The user selects a pipe size and the corresponding bolt qty, diameter
and
[quoted text clipped - 5 lines]
I cannot get a combo or list box control on the main form to populate
with
the subform value as a default value.