Automatically select in a sub form by a number chosen in the main

  • Thread starter Thread starter Kelly
  • Start date Start date
K

Kelly

How can I automatically select in a sub form by a number chosen in the main
form.
The main form is has a master/child relationship with ConduID/ConduitID. The
jobs are based to view the data with a parameter set on a Drawing number
field. That works great to get the appropriate job but I have created a combo
to query records from a table to populate the sub form. It displays all the
records but I need it to display the ones with a particular drawing number.

Main form
SELECT Conduit.ConduitName, Conduit.SecondaryConduitName, Conduit.DwgNum,
Conduit.SizeOfConduit, Conduit.ConduitNumber, Conduit.ConduID
FROM Conduit
WHERE (((Conduit.DwgNum) Like [Which Drawing]));

Subform
SELECT CircuitDetail.CircuitID, CircuitDetail.ConduitID,
CircuitDetail.CircNameID, CircuitDetail.CircRevisionNum,
CircuitDetail.NumberOfConductors, CircuitDetail.LengthOfCable,
CircuitDetail.SqInPerKeyMark, CircuitDetail.TotLenPerCirc,
CircuitsData.CircID, CircuitsData.KeyMark, CircuitsData.Description,
CircuitsData.FromEquip, CircuitsData.ToEquip, CircuitsData.CircuitName,
CircuitsData.DwgNum
FROM CircuitsData INNER JOIN CircuitDetail ON CircuitsData.CircID =
CircuitDetail.CircNameID;

Combo box (CircNameID)
SELECT CircuitsData.CircID, CircuitsData.CircuitName,
CircuitsData.FromEquip, CircuitsData.ToEquip
FROM CircuitsData
ORDER BY CircuitsData.FromEquip;

Combo box is set to Column count 4; column heads yes; column widths
0";1";3";3"; bound column 1; List width 6â€

I also tried listing a drawing number in the combo but that didn’t work
either. Thanks in advance to anyone with an idea how to fix the problem.


Kelly
 
Try setting the subform's filter in the After Update event of the Combo on
the main form:

With Me.SubformControlName.Form
.Filter = "[CircuitID] = " & Me.MyCombo
.FilterOn = True
End With
 
Back
Top