D
David G.
I have a form that every time I open it a new record gets added to
one of the tables used in the form's record source (which is an
embedded query).
The form is a pop up (though a record gets added regardless of how the
form is opened) and uses values from controls on a main form to fill
unbound combo boxes in the header. The combo box values are used to
filter the record source, and to provide default values for new
records.
tblMaterial is the table that gets the new record. The following 2
fields get values:
tblMaterialID PK autonumber
tblMaterial.tblClassID FK
The remaining fields in tblMaterialID are blank.
The record source SQL:
SELECT tblMaterial.tblClassID, tblMaterial.tblCategoryID,
tblMaterial.tblTypeID, tblMaterial.tblBrandID,
tblSample.tblMaterialID, tblSample.tblSampleID,
tblSample.tblSampleDate, tblSample.tblSampleBatchNumber,
tblSample.tblSampleBatchRev, tblSample.tblSampleTime,
tblSample.tblLocationID, tblSample.tblLineID, tblSample.tblVendorID,
tblSample.tblSampleSKU, tblSample.tblSampleDateCode
FROM tblMaterial INNER JOIN tblSample ON tblMaterial.tblMaterialID =
tblSample.tblMaterialID
WHERE (((tblMaterial.tblClassID)=1) AND
((tblMaterial.tblCategoryID)=[Forms]![frmNewSample]![cboCategoryID])
AND ((tblMaterial.tblBrandID)=[Forms]![frmNewSample]![cboBrandID]) AND
((tblSample.tblMaterialID)=[Forms]![frmNewSample]![cboMaterialID])) OR
(((tblMaterial.tblClassID)=2) AND
((tblMaterial.tblTypeID)=[Forms]![frmNewSample]![cboTypeID]) AND
((tblSample.tblMaterialID)=[Forms]![frmNewSample]![cboMaterialID]))
ORDER BY tblMaterial.tblClassID, tblMaterial.tblCategoryID,
tblMaterial.tblBrandID, tblSample.tblSampleDate,
tblSample.tblSampleTime;
THANKS!
David G.
one of the tables used in the form's record source (which is an
embedded query).
The form is a pop up (though a record gets added regardless of how the
form is opened) and uses values from controls on a main form to fill
unbound combo boxes in the header. The combo box values are used to
filter the record source, and to provide default values for new
records.
tblMaterial is the table that gets the new record. The following 2
fields get values:
tblMaterialID PK autonumber
tblMaterial.tblClassID FK
The remaining fields in tblMaterialID are blank.
The record source SQL:
SELECT tblMaterial.tblClassID, tblMaterial.tblCategoryID,
tblMaterial.tblTypeID, tblMaterial.tblBrandID,
tblSample.tblMaterialID, tblSample.tblSampleID,
tblSample.tblSampleDate, tblSample.tblSampleBatchNumber,
tblSample.tblSampleBatchRev, tblSample.tblSampleTime,
tblSample.tblLocationID, tblSample.tblLineID, tblSample.tblVendorID,
tblSample.tblSampleSKU, tblSample.tblSampleDateCode
FROM tblMaterial INNER JOIN tblSample ON tblMaterial.tblMaterialID =
tblSample.tblMaterialID
WHERE (((tblMaterial.tblClassID)=1) AND
((tblMaterial.tblCategoryID)=[Forms]![frmNewSample]![cboCategoryID])
AND ((tblMaterial.tblBrandID)=[Forms]![frmNewSample]![cboBrandID]) AND
((tblSample.tblMaterialID)=[Forms]![frmNewSample]![cboMaterialID])) OR
(((tblMaterial.tblClassID)=2) AND
((tblMaterial.tblTypeID)=[Forms]![frmNewSample]![cboTypeID]) AND
((tblSample.tblMaterialID)=[Forms]![frmNewSample]![cboMaterialID]))
ORDER BY tblMaterial.tblClassID, tblMaterial.tblCategoryID,
tblMaterial.tblBrandID, tblSample.tblSampleDate,
tblSample.tblSampleTime;
THANKS!
David G.