cCod = '1' cBranch = 'Brn1' IF Thisform.Check1.Value = 1 cCondition = 'ItmMast.ItemCod = cCod' Else cCondition = 'ItmMast.ItemBrn = cBranch' Endif cSql = "Select ItmCod, ItmDes From ItmMast Where " + cCondition *- Then execute the sql statement using macro substitution &cSqlOr to construct a SQL command without Macro Substitution you can try this:
cCod = '1' cBranch = 'Brn1' IF Thisform.Check1.Value = 1 Select ItmCod, ItmDes From ItmMast Where ItmMast.ItemCod = cCod Else Select ItmCod, ItmDes From ItmMast Where ItmMast.ItemBrn = cBranch EndifGlenn