Very simple problem: I have a Public Sub (in a module) that I want to call from a button on a form. The name of the function I want to call from the module is GenerateKML.
I've read this post:
And tried all of the suggested methods, none of which are working for me. There may be a problem with my code, but when I'm in Code view (editing the module) and press the 'play' button the code runs properly (a KML file is created).
If I use the second method suggested (call a subroutine in a module from a form) I get this error message:
Compile Error
Expected variable or procedure, not module
And if I use the third method (call a subroutine from a form without using an event procedure) I get this:
The expression On Click you entered as the event property...: The expression you entered has a function name that [my DB name] can't find.
So I suspect there's something wrong with how I'm calling the code I want to run.
This is how the code for my module starts:
Option Compare Database
Public Sub GenerateKML()
'
' GenerateKML Macro
' Macro recorded 26/09/2006 by simon_a
' Adapted and imported to Access by SAA
' 03 aug 2007 - v3.0 - 2007 08 06 19 24
'
' DECLARE VARIABLES
Dim filename As String
Dim docname As String