Combo Box in SubForm

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a fairly simple form and subform. The subform is in datasheet view and
contain several records related to the mainform. In the subform I have 2
combo boxes. The first combo box looks up a list of Blocks from a table
(BlockDetails). The first column (BlockDetailsID) is the bound column but
displays column 2 (BlockDetailsName). Pretty Basic and works fine. The second
combo box looks up IrrigationValves from a table called IrrigationValves. It
only shows IrrigValves that are related to BlockDetails, using the value
from the first combo box. Again, column one (IrrigValveID) is bound but I
want to show column two (IrrigValveName). This works fine but as soon as I
move to a new record in the subform or go between records the value
(IrrigValveName)in the previous records disappear. If I change combo box 2 to
show column 1 it works fine.
I hope I have made myself clear enough?
Thanks
 
I beg again for help!!
The data lookup query for combo box 1 is;
SELECT BlockDetails.BlockDetailsID, BlockDetails.BlockNumber FROM
BlockDetails;

and the 2nd combo box is;

SELECT IrrigationValves.IrrigationValveID, IrrigationValves.IrrigationValve,
BlockSetup.BlockDetailsID, BlockSetup.SetupDate, BlockSetup.PloughOutDate
FROM IrrigationValves INNER JOIN BlockSetup ON
IrrigationValves.IrrigationValveID=BlockSetup.IrrigationValveID WHERE
(((BlockSetup.BlockDetailsID)=Forms![IrrigSchedulefrm-copy]![IrrigationScheduleDetails
subfrm-copy].Form!BlockDetailsID) And
((BlockSetup.SetupDate)<Forms![IrrigSchedulefrm-copy]!SetupDate) And
((BlockSetup.PloughOutDate) Is Null Or
(BlockSetup.PloughOutDate)>Forms![IrrigSchedulefrm-copy]!SetupDate));

In both boxes, the second column is the displayed one in my form.
The IrrigationValve column in my subform has no value in until I refocus it
using the dropdown list
in the combo box. The data is stored in my table Okay.
Many Thanks
I hope someone can help me.
dhowe
 
Can't anyone at least comment on the problem? Havn't I explained the problem
properly?
Thanks again
dhowe
 
Back
Top