An ionic compound only works as an electrolyte when its ions can move. In a solid lattice the ions are fixed, but when the compound is molten or dissolved in water the ions are free to carry charge.
Step-by-step lessons on Edexcel GCSE Combined Science Electrolytic processes. Each one builds up to exam-style questions.