You will need to move the declare to the declaration section of a module, You will also need to make it public if you want to call it from your form.