vba - Selectively set combobox values programmatically -
user select wells , automatically displays samples may have:


in samples combobox fields 'ec' , 'ec_undetected' related 'cl' , 'cl_undetected'. if (ec_undetected = true) 'ec' empty , therefore redundant show both.
instead of showing both column, show 1 column either shows actual value or "undetected" when if (ec_undetected = true). should try use same alias 'ec'.
currently sql query on well_list_click:
sql = "select " _ & "samplers.id, samples.id, sampling_date [date sampled], samplers.last_name [sampler], ec, ec_undetected, cl, cl_undetected, ammonia, ammonia_undetected, nitrate, nitrate_undetected, water_level_from_surface [lvl fr surface], laboratory_name [lab], provincial_audit [audit], background, samples.comments " _ & "from samplers inner join (laboratories inner join samples on laboratories.id = samples.laboratory_id) on samplers.id = samples.sampler_id " _ & "where well_id=" & wellobj.wellid _ & " order sampling_date" sample_list.rowsource = sql what best approach solve user requirement? i'm not sure begin since sample combobox can have multiple rows
use iif statement in query;
iif([ec_undetected], 'undetected', [ec]) ecvalue this give column called ecvalue either show value or string "undetected".
Comments
Post a Comment