text TO lcSQL TEXTMERGE noshow DECLARE @Instr_ID CHAR(12); SET @Instr_ID = <<VFP2SQL(m.tcInstructor)>>; SELECT instr_id, sex, tch_level, snb_level, tele_level, misc_level, criteria_2, criteria_3, criteria_4, criteria_5, on_job, experience, pop_up1_1, pop_up1_2, pop_up1_3, pop_up1_4, pop_up1_5, pop_up1_6, pop_up1_7, pop_up1_8, pop_up1_9, pop_up1_10, pop_up2_1, pop_up2_2, pop_up2_3, pop_up2_4, pop_up2_5, pop_up2_6, pop_up2_7, pop_up2_8, pop_up2_9, pop_up2_10, pop_up2_11, pop_up2_12, pop_up2_13, pop_up2_14, pop_up2_15, pop_up3_1, pop_up3_2, pop_up3_3, pop_up3_4, pop_up3_5, pop_up3_6, pop_up3_7, pop_up3_8, pop_up3_9, pop_up3_10, pop_up3_11, pop_up3_12, pop_up3_13, pop_up3_14, pop_up3_15 FROM dbo.b_instr WHERE instr_id= @Instr_ID <<m.lcSupervisorFilter>>; SELECT * from dbo.b_in_bs WHERE instr_id=@Instr_ID; ENDTEXT mysqlexec(m.lcSQL, 'csrTemp', program()) select csrTemp1 index on base_id tag base_id select csrTemp &&STEP 1 - would this new booking conflict with guest requirements? if alltrim(csrTemp.instr_id)==m.tcInstructor &&found instructor? do case case b_sched.pref_lvl2=3 and not csrTemp.sex=b_sched.sex lcReqOK = 'Booking requiring a specific gender would be violated' case b_sched.pref_lvl4=3 if !empty(b_sched.whichlevel) lcWhichLevel = lower(alltrim(b_sched.whichlevel)) do case case m.lcWhichLevel = 'tch_level' and not csrTemp.tch_level>=b_sched.tch_level lcReqOK = 'Booking requiring a minimum alpine level would be violated' case m.lcWhichLevel = 'snb_level' and not csrTemp.snb_level>=b_sched.snb_level lcReqOK = 'Booking requiring a minimum snowboard level would be violated' case m.lcWhichLevel = 'tele_level' and not csrTemp.tele_level>=b_sched.tele_level lcReqOK = 'Booking requiring a minimum telemark level would be violated' case m.lcWhichLevel = 'misc_level' and not csrTemp.misc_level>=b_sched.misc_level lcReqOK = 'Booking requiring a minimum other level would be violated' endcase endif case b_sched.pref_lvl11 = 3 if not seek(b_sched.base_id, 'csrTemp1', 'base_id') lcReqOK = 'Booking requiring specific instructor base would be violated' endif case b_sched.pref_lvl5=3 and not csrTemp.criteria_2=b_sched.criteria2 lcReqOK='Booking requiring specific "' + alltrim(prefs_bk.b_crit2) + '" selection would be violated'I added today an extra select statement in the lcSQL and the extra case for checking base_id.