Run Custom Sub from Switchboard Item
Hi there!
I am having a fair amount of trouble figuring this out, and I was hoping someone might know what I was doing wrong. Someone set up a switchboard (I think using the Switchboard wizard) in this Access DB. I've since taken on the project of automating a process and I want to use a switchboard item so it's a one-click, otherwise mostly automatic process. I have added the switchboard item, and when I click on it I get a msgbox displaying with my test text, so I think that is set up OK.
Right now, I am trying to have a click on the button launch a custom sub (that I still have to write). Right now all I have in that sub is another call to a Msgbox with other testing text.
Following is the relevant code - not all of it, but I think this is all that will be involved. It is all located in the code for the switchboard form right now. I don't know if this is OK, but I really don't know how to reassign everything if I move it to another place, like a module, but I imagine it should work even if it is messy, so...:
The Sub:
[vba]Private Sub runDeletions()
MsgBox "YAAAAAY"
End Sub[/vba]
Code within Private Function HandleButtonClick(intBtn As Integer):
[vba]
'... assumed this would be the proper "command" to use
Const conCmdRunCode = 8
'... have this display the value being used in the "argument" field before trying to "run" the sub
' Run code.
Case conCmdRunCode
MsgBox rs![Argument]
Application.Run rs![Argument][/vba]
I've found the Switchboard Items table, and added in the following record. It has
SwitchboardID as: 3 (this button is on its own page)
ItemNumber as: 1
Itemtext as: Run Pending Deletions
Command as: 8
Argument as: runDeletions()
I have also tried the Argument as /"runDeletions()/" and runDeletions and /"runDeletions/"
I am almost positive my trouble lies somewhere in these few things. I suspect I have the Argument field entered wrong. But what can I do to run this sub?!
Thank you for any suggestions you may have!