richard0805
asked on
Running Code from a Switchboard Item and passing an arugument
I want to run a sub routine called OpenCustomObject from a Switchboard item and pass an argument to it. However I get an error in HandleButtonClick function.
For Example
If I put 'OpenCustomObject "qryCustom"' in the Function Name on the Edit Switchboard Item it doesn't like it.
However if I hard code something like 'ObjectToOpen = "qryCustom"' in to the sub routine and then put 'OpenCustomObject' in to the Switchboard Item everything works fine.
Am I missing something or is it not possible to pass arguments to a sub routine from a Switchboard item?
For Example
If I put 'OpenCustomObject "qryCustom"' in the Function Name on the Edit Switchboard Item it doesn't like it.
However if I hard code something like 'ObjectToOpen = "qryCustom"' in to the sub routine and then put 'OpenCustomObject' in to the Switchboard Item everything works fine.
Am I missing something or is it not possible to pass arguments to a sub routine from a Switchboard item?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>Am I missing something or is it not possible to pass arguments to a sub routine from a Switchboard item?
It isn't, not using the default switchboard created by the horrible switchboard wizard - at least, not without rewriting the code it's written for you. The problem is that the 'OpenCustomObject "qryCustom"' is already being passed as an argument to the Run function already - so you're trying to pass an argument inside an argument, if you see what I mean.
It isn't, not using the default switchboard created by the horrible switchboard wizard - at least, not without rewriting the code it's written for you. The problem is that the 'OpenCustomObject "qryCustom"' is already being passed as an argument to the Run function already - so you're trying to pass an argument inside an argument, if you see what I mean.
Private Function HandleButtonClick(intBtn As Integer)
End Sub
Following is the example :
SwitchboardID ItemNumber ItemText Command Argument
2 1 Invoice Maintenance 3 joborder
switchboardId 2 indicates sequence of switchboard to be opened
intBtn is the sequence of items on switch board i.e if there are
Customer
Saleman
Transactions
Reports
Exit
and the user clicks Reports then intBtn will be 4