Last month I asked how run an SQL file in Base and was given a very effective code segment that was a an effective solution.
The code runs perfectly when called from the Macro menu.
However I now would like to call it from a button. I have an empty form with just one button on it (others will follow) which has the subroutine attached to its “Pressed” event.
The code contains this snippet.
if IsNull(ThisComponent.CurrentController.ActiveConnection) then
ThisComponent.CurrentController.connect
endif
When I run from the Macro menu, or single step from the Basic editor everything is fine.
When I run from the button the code runs as far as the snippet above and then gibe the error message BASIC runtime error.
“Property or method not found: ActiveConnection.”
Any suggestions as to what I should do please?