sql - Select items where count in another field matches (not updatable) -
here trying record products # swab location in main table matches count of swab locations in swab table , users can checked off y/n verify description of locations correct.
here example of 2 tables.
tblmainequipment asset_id equipmentname num_swaplocations verified 234 saijimon 2 n 235 pasquale 3 n tblmainswaplocations asset_id swap_location 234 particle cannon 234 railgun 235 particle cannon i use following query count number of records, avoided using having query combine both tables since not updatable.
qrymainswaplocationcount select msl.asset_id, count(asset_id) [count] tblmainswaplocation msl group msl.asset_id; this give me result of
qrymainswaplocationcount asset_id count 234 2 234 1 i used following record source form allow users verify inputs.
select meq.asset_id, meq.equipment_name,meq.num_swaplocations meq.verified tblmainequipment meq, qrymainswaplocationcount mslc (((meq.asset_id)=[mslc].[asset_id]) , ((meq.num_swaplocations)=[mslc].[count]); this result be
tblmainequipment asset_id equipmentname num_swaplocations verified 234 saijimon 2 n however record set not editable. there reasons this?
i think should put table tblmainequipment recordsource , bring fields on form:
then insert unbound textbox (perhaps close num_swaplocations field easy comparison):
then in new textbox, put following in controlsource:
=dcount("asset_id","tblmainswaplocations","asset_id=" & [asset_id])
then open form , should count number of records in table tblmainswaplocations have same asset_id record showing:
you'll able update verified field in tblmainequipment table.




Comments
Post a Comment