Tags:Microsoft, Access, 2000 and 2003, hyperlinks on forms, Visual Basic Application
I used a hyperlink function in one of my forms to go to other forms in Access 2000. Now we upgraded to Access2003 and the links no longer works. Here is the code of one of the links
Private Sub Label5_Click() 'Exit Main module and go to Client Reference Tables Management Const strCompactorMDB = "C:\GAAP\FRISMClient\FRISMClientRef.mdb" Dim strCommandLine Dim dbl_D As Double
strCommandLine = Quote(SysCmd(acSysCmdAccessDir) & _ "MSACCESS.EXE") & " " & Quote(strCompactorMDB) & _ " /cmd " & Quote(CurrentDb.Name) dbl_D = Shell(strCommandLine, vbNormalFocus) Application.Quit acQuitSaveAll ' close the current databasee End Sub
The hyperlinks on the form are set to open other .mdb files. This works well in A2000. Someone from this site helped with this back then.
Now it does not work. When I click the hyperlinks it gives me a series of warning and error messages in this order:
1. Info: You can't exit the FRISM system now. If you are running a Visual Basic Module that is using OLE or DDE, you may need to interrupt the module. OK or Cancel are your options here. 2. Warning: Hyperlinks can be harmful to your computer and data. To protect your computer, click only those hyperlinks from trusted sources. Do you want to continue? Yes or No here. If yes then you get the error next. 3 Error: Unable to open targetDB.mdb. Cannot open specified file.
In A2000, when the targetDB.mdb opens, the main or welcome form created in another Welcome.mdb closes. Each hyperlink targets various .mdbs each have its own purpose.
I don't understand your continued use of ' hyperlink' in this context.
The code you posted has nothing to do with hyperlinks. It is just code to open another db and close this one. A hyperlink doesn't involve any code - it is just an address.
Perhaps that is the problem- have you defined the label as a hyperlink when it is not?
It is a label and the code is on the OnClick event. When I said hyperlink I mean that when I point to it the arrow turns into a hand just like in the web browser.
Anyhow you are right, I tried it again and it is working with A2003. However it still gives me the messages I posted above and it gives me the security warning on a separate instance of A2003. I have to say OK to the security warning because if not I will not be able to open my targetDB.mdb. And, the welcome form (which is a separate .mdb) does not close when the target mdb opens. So I have 2 instances of A2003
My issue is that with the code I provided above, once the target form (located in another mdb) opens, the originating form in the Welcome.mdb does not close. It used to before when we were using A2000. The user clicks one of the labels and it takes them to the proper mdb file without having to use the Windows Explorer.
Also, the warning, info, error messages I mentioned above are still there.