Get module to run from macro and not just open the editor.

armitage

New member
Local time
Today, 14:58
Joined
Nov 29, 2006
Messages
7
Hi there.
First post \0/
I know i'm a noob and i was wondering if someone can help me perchance with my little module/macro problem.

My problem is that I've got a module that works fine if i manually run it when i'm in it, but when i call that module from a macro then all that happens is that the macro opens the module in design view.

At the moment my module looks like the following.

Module RunLookups
Code:
Option Compare Database

Sub AccessTest1()
      Dim A As Object
      Set A = CreateObject("Access.Application")
      
      A.Visible = False
      A.OpenCurrentDatabase ("w:\database\bas\lookups.mdb")
      A.DoCmd.RunMacro "checkcodes"
End Sub

The macro that calls this module seems to just open it.

CheckCodes
Code:
Setwarning > No
OpenModule > Module Name > RunLookups


Any suggestions on what im doing wrong?
How can i get the macro to run the module and not just open it?

Pls help im almost killing little kittens here.

Thanks for your help it's much appreciated.
 
Why don't you just write the code to call your function? See below

docmd.setwarning False
call AccessTest1
docmd.setwaring True
 
Just an update.
I've finally figured it out.

The problem was that I made two faults when writing this macro and module.
1: the module should have been a function (easily fixed by just renaming the sub to Function)
2: Using openModule was not the right way to go. I should have used RunCode> AccessTest1() to run the function.

Well all is working now some im a happy little camper :)
 
Too late :( It was late..........I was hungry......things happen.

If you want to save the kittens then faster replies are needed.

/me opens a fresh can of "little kittens in distress"........."aaaaaaah just as fresh as the day they were produced"
 

Users who are viewing this thread

Back
Top Bottom