I used Microsoft's Inventory DB and customized it to fit our needs. It works
absolutely fine the way I have it split. No one is using it yet but they
will once I'm done testing it. I have it split into a FE and BE and like I
said it's on a secure server. I then made the FE into an ACCDE so that it
would hide all the code and no one can change the desgin of it. When I did
this, it still keeps the FE and BE files and just creates a new file that
ends in ACCDE. I placed the ACCDE file on my desktop and when I open it, I
get the message I previously wrote.
The switchboard is very simple, it only has three options on it. One is to
open a form in add mode, second opens a report in print preview and the third
closes the DB. I used the switchboard manager to do this.
I tried the help and support on: http://support.microsoft.com/kb/162229
but still no luck. Even when I repeated the steps of creating a switchboard
after I split it, which creates a local switchboard table, I got the same
result when I converted to ACCDE.
This is the code that Access creates for the switchboard OnClick event
property
Private Function HandleButtonClick(intBtn As Integer)
' This function is called when a button is clicked.
' intBtn indicates which button was clicked.
' Constants for the commands that can be executed.
Const conCmdGotoSwitchboard = 1
Const conCmdOpenFormAdd = 2
Const conCmdOpenFormBrowse = 3
Const conCmdOpenReport = 4
Const conCmdCustomizeSwitchboard = 5
Const conCmdExitApplication = 6
Const conCmdRunMacro = 7
Const conCmdRunCode = 8
Const conCmdOpenPage = 9
' An error that is special cased.
Const conErrDoCmdCancelled = 2501
Dim con As Object
Dim rs As Object
Dim stSql As String
On Error GoTo HandleButtonClick_Err
' Find the item in the Switchboard Items table
' that corresponds to the button that was clicked.
Set con = Application.CurrentProject.Connection
Set rs = CreateObject("ADODB.Recordset")
stSql = "SELECT * FROM [Switchboard Items] "
stSql = stSql & "WHERE [SwitchboardID]=" & Me![SwitchboardID] & " AND
[ItemNumber]=" & intBtn
rs.Open stSql, con, 1 ' 1 = adOpenKeyset
' If no item matches, report the error and exit the function.
If (rs.EOF) Then
MsgBox "There was an error reading the Switchboard Items table."
rs.Close
Set rs = Nothing
Set con = Nothing
Exit Function
End If
Select Case rs![Command]
' Go to another switchboard.
Case conCmdGotoSwitchboard
Me.Filter = "[ItemNumber] = 0 AND [SwitchboardID]=" &
rs![Argument]
' Open a form in Add mode.
Case conCmdOpenFormAdd
DoCmd.OpenForm rs![Argument], , , , acAdd
' Open a form.
Case conCmdOpenFormBrowse
DoCmd.OpenForm rs![Argument]
' Open a report.
Case conCmdOpenReport
DoCmd.OpenReport rs![Argument], acPreview
' Customize the Switchboard.
Case conCmdCustomizeSwitchboard
' Handle the case where the Switchboard Manager
' is not installed (e.g. Minimal Install).
On Error Resume Next
Application.Run "ACWZMAIN.sbm_Entry"
If (Err <> 0) Then MsgBox "Command not available."
On Error GoTo 0
' Update the form.
Me.Filter = "[ItemNumber] = 0 AND [Argument] = 'Default' "
Me.Caption = Nz(Me![ItemText], "")
FillOptions
' Exit the application.
Case conCmdExitApplication
CloseCurrentDatabase
' Run a macro.
Case conCmdRunMacro
DoCmd.RunMacro rs![Argument]
' Run code.
Case conCmdRunCode
Application.Run rs![Argument]
' Open a Data Access Page
Case conCmdOpenPage
DoCmd.OpenDataAccessPage rs![Argument]
' Any other command is unrecognized.
Case Else
MsgBox "Unknown option."
End Select
' Close the recordset and the database.
rs.Close
HandleButtonClick_Exit:
On Error Resume Next
Set rs = Nothing
Set con = Nothing
Exit Function
HandleButtonClick_Err:
' If the action was cancelled by the user for
' some reason, don't display an error message.
' Instead, resume on the next line.
If (Err = conErrDoCmdCancelled) Then
Resume Next
Else
MsgBox "There was an error executing the command.", vbCritical
Resume HandleButtonClick_Exit
End If
End Function
Thanks for your help.
Post by Dirk GoldgarPost by Mya48I have the same exact problem. My ACCDE is in a trusted location on our
server and the code does not work properly. The first thing that should open
up is a switchboard and it does but the buttons don't work.
The error says: The expression On CLick you entered as the event property
setting produced the following error: The expression you entered has a
function name that Office Supplies Inventory can't find.
Thanks for your help,
Mayra
It could be an issue with macro security or Jet sandbox mode, or it could be
a problem with references.
You say that your ACCDE is on a server. Does that mean your application is
not split into front-end and back-end, so all users are sharing the same
monolithic database file? That can work, but it's subject to a number of
problems -- it's more vulnerable to corruption, and prone to broken
references. It's generally better to split the application into a back-end
ACCDB containing just the tables, and front-end ACCDE containing everything
else, with links to the tables in the back-end. The back-end sits on the
server, and each user has her own copy of the front-end, on her own PC.
In your current case, does the ACCDE work when run from your own PC, or the
PC where you developed it?
How are the buttons on the switchboard set up? Do they execute embedded
macros, stored macros, event procedures, or function expressions? If you
aren't sure, just check the On Click event property from one of them and
tell me what it says.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)