Export to Text

jco23

Registered User.
Local time
Today, 03:19
Joined
Jun 2, 2015
Messages
71
Hi all,

I'm having some trouble getting my database to run a public function called "Export_as_Txt".

I have the VBA coding setup as, "Public Function Export_as_Text()" both within the form's VBA code and within a module named "Export_as_Txt".

I then want users to be able to run this function via command button to export a query's results in a form to a formatted text file. however, when running the command, I get an error message saying that access cannot find the object 'Export_as_Txt()'.

my command line reads: DoCmd.OpenFunction "Export_as_Txt()", acViewNormal, acEdit

i have also tried: Call Export_as_Txt

my theory is that this public function (although saved in a module) is not being recognized as a macro or public function.

I tried commenting out the public function from the form's VBA code, but still to no avail.

any help would be greatly appreciated.

thanks!
 
You'd use the name of the function, not the module, and no DoCmd, just:

Export_as_Text
 

Users who are viewing this thread

Back
Top Bottom