An ECL approach was developed for the determination of codeine or morphine based on tris(2,2'-bipyridine)ruthenium(II) (Ru(bpy)(3)(2+)) immobilized in organically modified silicates (ORMOSILs). Tetramethoxysilane (TMOS) and dimethyldimethoxysilane (DiMe-DiMOS) were selected as co-precursors for ORMOSILs, which were then immobilized on a surface of glassy carbon electrode (GCE) by a dip-coating process. Ru(bpy)(3)(2+) was immobilized in the ORMOSIL film via ion-association with poly(p-styrenesulphonate). The ORMOSIL-modified GCE presented good electrochemical and photochemical activities. In a flow system, the eluted codeine or morphine was oxidized on the modified GCE and reacted with immobilized Ru(bpy)(3)(2+) at a potential of +1.20 V (vs. Ag/AgCl). The modified electrode was used for the ECL determination of codeine or morphine and showed high sensitivity. The calibration curves were linear in the range 2 x 10(-8)-5 x 10(-5) mol/L for codeine and 1 x 10(-7)-3 x 10(-4) mol/L for morphine. The detection limit was 5 x 10(-9) mol/L for codeine and 3 x 10(-8) mol/L for morphine, at signal:noise ratio (S:N)=3. Both codeine and morphine showed reproducibility with RSD values <2.5% at 1.0 x 10(-6) mol/L. Furthermore, the modified electrode immobilized Ru(bpy)(3)(2+) was applied to the ECL determination of codeine or morphine in incitant samples.