Switchboard Links

G

Guest

Hi all

I'm sorry of this questions has been asked before, but I've searched and
can't find anything.

I'm trying to create a switchboard in a very simple database. Everytime I
create the switchboard and I think its right, I close the switchboard down,
open it up and its all fine. So then I close the whole database and open it
up again to double-check. That's when none of the links the the switchboard
will work. It has several sub-forms and I've done several switchboards before
with no probs. I think I must have created this current one 5 times now
trying to sort out this issue. To clarify, the switchboard is fine until I
close the db, but when I re-open it, all the links disappear. Can somebody
please help?

Thank you in advance,
Alison
 
G

Guest

Hi Alison,

What version of Access are you working with? Are you using the Switchboard
Manager wizard to create your switchboard, or are you creating your own
switchboard from scratch? If you are using the Switchboard manager, then it
appears as if something is preventing the code behind this form from running.
The wizard creates a bound form (bound to the "Switchboard Items" table).
Starting with Access 2000, the code behind the switchboard form is ADO
(ActiveX Data Objects) code. In Access 97, similar Switchboard code was DAO
(Data Access Objects) based code.

If you are using Access 2007, and the folder is not a trusted location, then
this could prevent any VBA code from running. To be honest, I have not worked
with Access 2007 very much. As such, I'm not familiar with any equivalent
functionality for the earlier Switchboard Manager wizard, although I would
think that 2007 would use macros instead, since Microsoft has been pushing
macros heavily in Access 2007. In any case, if you are using 2007, you might
want to verify that the folder is trusted:

Dealing with the Trust Center (Access 2007 only)
http://www.access.qbuilt.com/html/trust_center.html


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 
G

Guest

Hi Tom

I'm sorry, I should have been clearer. I'm working with Access 2003 and am
using the wizard.
 
G

Guest

Hi Alison,

Okay, first thing verify that you can see the Switchboard Items table, and
that it has the records in it that you would expect to see (one record for
each button you defined). Open the Switchboard form in design view. Click on
View > Code. Then click on Debug > Compile ProjectName, where ProjectName is
the name of your VBA project (likely the same as your database, but it can be
changed as well). Does your code compile without any errors? You will know
if it compiled okay if this option becomes "greyed out" if you try to
immediately access it again, before doing anything else in the VBE (Visual
Basic Editor).

If you find any compile errors, even if they are in a different module, then
fix these first. Also, verify that you do not have any references marked as
"MISSING". To do this, click on Tools > References, when you have the VBE
open.

If none of this helps so far, then close Access. Then click on Start > Run,
and enter the following command to re-register the ADO library:

Regsvr32 "C:\Program Files\Common Files\system\ado\Msado15.dll"

Just for good measure, issue these two commands as well:

Regsvr32 "C:\Program Files\Common Files\Microsoft Shared\DAO\Dao360.dll"

and

regsvr32 msjtes40.dll

Don't forget to include the indicated quotes in the paths shown above. You
should see a message indicating success in each case. Then restart your
application. Does the Switchboard display correctly now?

Note: The switchboard uses late bound ADO code, so while a reference is not
required for switchboard wizard generated code to run, the ADO library must
still be registered correctly.


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 
G

Guest

Thanks for your response, Tom. However, I can't even get to the "Compile
ProjectName" part. I can get to the debugging part, but the compile part is
greyed out. Where to from here?
 
G

Guest

Hi Alison,
I can get to the debugging part, but the compile part is
greyed out.

That's a good sign. It is an indication that your code does compile without
an error.

Try the following (this should work as long as you only have one version of
Access installed on your PC):

Start > Run | msaccess /decompile

Hold down the Shift key while opening your database. This should force any
compiled VBA code to be discarded. While continuing to hold down the Shift
key the entire time, click on Tools > Database Utilities > Compact and Repair
Database.

Now, reopen your switchboard form, and click on View > Code. Attempt to
compile the code once again, using Debug > Compile ProjectName. This time, it
should definately not be greyed out. Close Access and restart your
application normally (without holding down the shift key). Does your
switchboard work now?

If not, are you able to send me a zipped copy of your database? If you can
do this, send me a private e-mail message with a valid reply-to address. My
e-mail address is available at the bottom of the contributor's page indicated
below. Please do not post your e-mail address (or mine) to a newsgroup reply.
Doing so will only attract the unwanted attention of spammers.


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 
G

Guest

I've sent you an email, Tom.

Tom Wickerath said:
Hi Alison,


That's a good sign. It is an indication that your code does compile without
an error.

Try the following (this should work as long as you only have one version of
Access installed on your PC):

Start > Run | msaccess /decompile

Hold down the Shift key while opening your database. This should force any
compiled VBA code to be discarded. While continuing to hold down the Shift
key the entire time, click on Tools > Database Utilities > Compact and Repair
Database.

Now, reopen your switchboard form, and click on View > Code. Attempt to
compile the code once again, using Debug > Compile ProjectName. This time, it
should definately not be greyed out. Close Access and restart your
application normally (without holding down the shift key). Does your
switchboard work now?

If not, are you able to send me a zipped copy of your database? If you can
do this, send me a private e-mail message with a valid reply-to address. My
e-mail address is available at the bottom of the contributor's page indicated
below. Please do not post your e-mail address (or mine) to a newsgroup reply.
Doing so will only attract the unwanted attention of spammers.


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 
G

Guest

Hi Alison,

Definately a corrupt form! The only button that worked on your switchboard,
for me, was the one labelled "Close Database". I will send a copy of your
database back to you soon.

For anyone else who is interested, I tried the following, without success:

1.) Import all objects into a new DB container
2.) Use the undocumented SaveAsText / LoadFromText commands, ie:

Application.SaveAstext acForm, "Switchboard", "C:\Temp\Switchboard.txt"
Application.LoadFromText acForm, "Switchboard", "C:\Temp\Switchboard.txt"

I was able to get a switchboard to function by "faking out" the Switchboard
Manager Wizard:
a.) Rename "Switchboard Items" table.
b.) Rename the Switchboard form.

and then invoke the wizard to create a new Switchboard Items table and
Switchboard form. However, when I deleted the module associated with the
original switchboard (Has Module ---> No), saved the form, compacted the
database, and then copied the module from the new switchboard to the original
switchboard, the buttons were still dead in the water.

I ended up fixing this by destroying the module (once again), by setting the
Has Module property to No. Then I created a new form that was bound to the
Switchboard Items table. I opened the original switchboard in design view,
selected all objects (with Ctrl A), and pasted them into my new form.
Finally, I restored the VBA code behind this form from a copy that had been
previously saved to a text file.

Alison--It seems to be working for me now, including closing and re-opening
the database. Also, I added a better close procdure to your switchboard, so
that Access will close in addition to your database. I did this by changing
this section in the switchboard form's class module:

' Exit the application.
Case conCmdExitApplication
CloseCurrentDatabase

to this:


' Exit the application.
Case conCmdExitApplication
Dim intResponse As Integer
intResponse = MsgBox("Do You Want To Close This Application?", _
vbQuestion + vbYesNo, "Exit Application?")
If intResponse = vbYes Then
DoCmd.Quit
End If



Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top