Put this at the very top of the code module above all the procedures.

Dim X as String

This will declare the variable X and it will be accessible to the other procedures within the code module.