running code from switchboard

jalldridge

Registered User.
Local time
Today, 01:53
Joined
May 3, 2005
Messages
60
I've got a form that has some code behind it that queries databases / updates and sends out email. This all works nicely...

However at the moment the user makes a selection in the switchboard to show this form. They then have to click on the 'go' button to get the code behind the form to work. The form has nothing else in it - just a command button

I would like to be able to get the code to run once the use has selected the option in the switchboard - thereby removing the added step of them pressing the go button.

Whats the best way of doing this?

I tried copying all code from the form into a module (changing all privates to public). However when I try and run the code from the switch board I get a an error saying 'there was an error executing the command'. This error is produced when the following is trying to be run in the switchboard code:

Application.Run rs![Argument]

rs![Argument] in this instance = basAutoUpdate.startUpdate()

basxx is the module name and startUpdate is a public sub

Any ideas how to resolve my query???? :-)

Thanks
 
Last edited:
I think that you have to call a Function from the swithboard not a Sub, so try renaming it to a Function

HTH

Peter
 
Hi Peter,

Ok turned my public sub into a public function ala:

Code:
Public Function basstartUpdate() As Boolean

'Public Sub startUpdate()
    If getOutlook Then
        closeOutlook
    Else
        MsgBox "Error in getting details from outlook", vbInformation
    End If
    
    basStartUpdate = True
End Function


This still didnt work so I looked at the error description and number.

Number = 2517
Description = Database cant find the procedure 'basAutoUpdate.basstartUpdate()'.

So it looks like the switchboard cant find my module :-(

Any other ideas???
 
Last edited:
You dont need to ref the module just the code

basstartUpdate()

Peter
 
Managed to get things working now.

Thanks for your pointers.
 

Users who are viewing this thread

Back
Top Bottom