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 database 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 VBA code - not all of it, but I think this is all that will be involved. runDeletions() is located in its own module "Module3":
The Sub:
This is the code in the switchboard form that deals with the arguments taken - and that will call the above function. Code within Private Function HandleButtonClick(intBtn As Integer):
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: Module3.runDeletions()
I'm pretty sure my Argument is wrong. I've tried a few things but can't figure it out. What could I use as my Argument so my sub runDeletions in my module Module3 will run when this button is clicked?
Thanks!
PS - I've also posted this question here: http://www.vbaexpress.com/forum/showthread.php?t=16611 and any differences in code are intentional, as I keep trying different things (but so far no luck)...
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 database 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 VBA code - not all of it, but I think this is all that will be involved. runDeletions() is located in its own module "Module3":
The Sub:
Code:
Public Sub runDeletions()
MsgBox "testing - runDeletions ran successfully"
End Sub
This is the code in the switchboard form that deals with the arguments taken - and that will call the above function. Code within Private Function HandleButtonClick(intBtn As Integer):
Code:
'...have the argument set to 8...
Const conCmdRunCode = 8
'... so this Case will run:
Case conCmdRunCode
' optional, just tells me the value of the argument being used
' MsgBox rs![Argument]
'actually is what tries to call the Sub
Application.Run rs![Argument]
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: Module3.runDeletions()
I'm pretty sure my Argument is wrong. I've tried a few things but can't figure it out. What could I use as my Argument so my sub runDeletions in my module Module3 will run when this button is clicked?
Thanks!
PS - I've also posted this question here: http://www.vbaexpress.com/forum/showthread.php?t=16611 and any differences in code are intentional, as I keep trying different things (but so far no luck)...