Access Switchboard error message

Joined
Oct 12, 2017
Messages
3
Reaction score
1
(This is also posted on another Access forum)

I have created three switchboards (created using Access 2013) for use with a database that previously worked as expected but now some of the choices are giving me the following error message: "An expression in argument 3 has an invalid value."

I had these switchboards working in a test DB and, as they all were working as expected, exported them to the production DB. It is in the production DB that they are giving this message.

The structure of the three switchboards is: switchboard1 is for administrators/Dept heads and consists of choices to launch the other two switchboards and choices only for admins. Switchboard 2 is for authorized office users and consists of choices pertaining only to their department. Finally, switchboard 3 is for the shipping/receiving department and, like the office users, contains only choices for those authorized in that department.

The menu choices that are generating this message seem to be one of two types:

1) Going to a different switchboard (a command "1" in the switchboard table leading to a correct switchboard #, item# 0, command# 0 in the table) OR

2) Opening a form in either add or edit mode (command 2 or 3 in the switchboard table).

I have visually traced all the switchboard numbers, item numbers and commands in the switchboard table and they all check out OK. I have checked the forms for proper record sources and they all check out OK.

My questions is: where do I find this argument 3 the error message refers to so I can see what expression has the invalid value? I don't believe it is referring to the argument column in the related switchboard table.

Any help is welcomed and appreciated....

John

(Hoping Jeff Conrad will be among those who reply as I'm using a book he wrote :))
 
OK... I found the solution!

It centers around a couple things. In my case, because I was using multiple switchboards within one database, I was forced to give them different names. The tables and forms need to be the same names (i.e. switchboard abc items (table name) and switchboard abc (form name). These need to be identical! Secondly, and this is where the error message (an expression in argument 3 has an invalid value) is generated... You need to open the affected form in design view, open the properties window, choose OptionLabel1, and click on the OnOpen Embedded Macro ellipsis to reveal the coding. This is the Macro coding for the switchboard commands (1, goto switchboard; 2, open form in add mode; 3, open form in edit mode, etc.). You'll find an OnError Macro first in the list, then an If statement referencing [command] = 1. There are two Set Properties for the Label 1 and Label 2 controls. It is within these statements my error was occurring. The commands that referenced the tables for the forms (switchboard abc items - referenced above - for the switchboard abc form) were referencing the incorrect switchboard name (following the above example, it referenced switchboard items instead of switchboard abc items)! I changed that to the correct switchboard name (switchboard abc items) and, voila! everything now works!

Hope this helps others.....
 
Back
Top