Open an external file with a button on a form in Access 2007 - ms-access

I am creating a database for my Unit (I am in the Army) and I need a button that will launch a file when clicked. The file is a .xfdl file used for military forms in a program called PureEdge. Is this possible and how would I go about doing it. I have searched it as much as I know how, but it seems that my Google-Fu is failing me.
Thanks for any help.

If the file type is associated with the program, that is, the file will launch when clicked, then FollowHyperlink may suit, otherwise, you may need to use Shell. For example:
Call Shell("""C:\Program Files\Microsoft Office\Office14\msaccess.exe"" ""c:\docs\db.mdb""", vbNormalFocus)

Related

How to use VBA to browse to file in Access 97?

I'm trying to write a message dialog to prompt the user to point to a TXT file that will be analysed by the program.
How can I make this file explorer prompt in VBA 97?
There's supposed to be a 'openfile' function somewhere but I can't find it. Also the description of the object applications doesn't seem to mention anything about a file prompt. I noticed that in newer versions there's a class called OpenFileDialog and another called FileDialog that seems it would do the trick, but, again, it doesn't seem to be available in Access 97
You want the Common Dialog Control:
http://access.mvps.org/access/api/api0001.htm
http://support.microsoft.com/kb/824272

OpenFile Dialog MS Access 2010

I followed the suggestion by Cody Gray about halfway down the page in this thread but I'm having no luck.
Unless I'm missing something, this is supposed to allow me to navigate from Access, using the Windows API Dialog Box, to the relevant folder and open a file, no? I'm trying to open a Word doc which has a Mail Merge coming back to the same Access Db. I needed the dialog because there are multiple files that may be selected at different times.
I added all the suggested code and while the process runs without error, when I get to the final step, the selected file doesn't open. Nothing happens.
I realize this is not much help without an error message. Any thoughts nonetheless?
As I understand the situation, you have code which uses a string variable named strFileToOpen to hold the path to a Ms Word document. And now you want to open that file in Word.
You can use the FollowHyperlink method.
Application.FollowHyperlink strFileToOpen
Look at the Access help topic for that method. It offers other options you may wish to use.
Also I suggest you look at the help topic for FileDialog Object. It is simpler than the Windows APi method in the code you linked.

Opening an Access Form from a hyperlink

We currently have an ASP/SQl Server system, which has an option to send an e-mail to a user. This e-mail contains a hyperlink to another ASP page, which shows a specific database record.
I'm currently working on a resilience version of the system, which is MS Access based. The user's would like to keep the same functionality, and have an e-mail which contains a hyperlink back to the database, opening a specific form and filtering it to a record.
I believe the solution lies somewhere in using Command() to get the parameters from the command line, however I am actually having difficulty currently opening the database itself. The code i'm currently using is:
<a href="C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.exe
H:\Access DB\11th March\Link to DB\Dealer
Startup Admin EU v10.mdb" >
TEST
</a>
I think this should open the Dealer Startup database, however it is failing stating the file cannot be found. If I remove the second step i.e. H:\Access DB etc. the link opens Access, so I am wondering if i'm doing something syntactically incorrect? The file path definitely seems right.
Also would someone be able to give some advice on the use of /c in a hyperlink? The small amount of information I have found seems to suggest it doesn't work but if someone could clarify or give me an example of how to do it I would appreciate it
Thanks,
Chris
I managed to create a solution to this problem. I could not find a direct way to open the Access DB from a hyperlink, however you can hyperlink to a shortcut. The workaround I therefore used was to create a shortcut to the database using the following syntax:
"file path to ms access" "file path to database" /cmd Args
so for example:
"C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.exe" "C:\Documents and Settings\Database.mdb" /cmd Args
Creating a shortcut to this file path opens the database. I then created an autoexec macro which opened a specified form if the Command() function returned Args. This meant that when opening the database normally you would be taken to the usual form, but when opening from the shortcut you will be taken to a different form.
I then created the e-mail hyperlink to the shortcut.
I have created a batch file to delete browser history for MSIE and kept it on the server-side. When the user clicks on 'delete browser history' hyperlink, I just make him download this file, and the user runs it manually.
You can also do something similar.

MS Access 2007 Import Not Working?

I just switched from Access 2003 to Access 2007. In the very first "dev" copy (as I call it) pre-split, pre-front end, I need to import some data that are text files. I try to use the ribbon to do this, and after I walk through the steps I get this little pop up box that states
Microsoft Access has determined this to be a potential security risk. You shouldn't accept....
Then I Click OK to accept (open the file)... and nothing happens...no import, no file.
So I tried making a new table on import, creating a table in access then importing, coverting the data file to xls & web before importing, using a completely different data file. Nothing seems to change the outcome of Access not firing off some type of import event (which I think is supposed to be a wizard or something??)
So does anyone have any ideas what is going on with this?
I would just code the data import but I don't know how (without using the wizard to at least create the specification).
Is the folder where the database resides configured as a Trusted Location? I know VBA code won't run if it's not. I wasn't aware those types of restrictions extended to file import from the Ribbon. However, your error message sounds similar to a Trusted Location issue, so it may be worth checking.
See Create, remove, or change a trusted location for your files for detailed instructions on managing Trusted Locations.
Access was formerly very fussy about extensions and would stop working if, for example, a text file did not have an expected extension. It used to be necessary to modify the registry to get around this. It seems that the problem may still exist.

Associate a help file with a library in the VBA object browser

I have a reference to the Microsoft Scripting Runtime (scrrun.dll) in one of my Access projects. If I open the object browser in VBA (by pressing F2) and choose 'Scripting' from the library dropdown it shows me all of the properties, functions, etc. for the Scripting library. If I choose one of these functions and then click on the help button (with the yellow question mark) it opens a help window with the title of 'Microsoft Visual Basic Help.'
It acts like it is unable to find the help file for this library. I can manually find the help file on my computer at the following location: "C:\Program Files (x86)\Common Files\microsoft shared\VBA\VBA6\1033\VBLR6.CHM". (Note: I have 64-bit Win 7, thus the '(x86)' in the Program Files folder name.)
I tried copying the help file to the following locations with no luck:
"C:\Windows\Help\VBLR6.CHM"
"C:\Windows\SysWOW64\VBLR6.CHM" (I believe SysWOW64 folder is the Win7 64-bit equivalent of C:\Windows\System32)
I have had this same problem with other referenced libraries as well, so I'm looking for some kind of generic solution. I'm hoping there is some way to specify a location for the help file of a particular reference, or something else along those lines.
Copy VBLR6.CHM to "C:\Program Files (x86)\Microsoft Office\Office10\1033\VBENLR98.CHM"
That's the short answer for this specific case...here's how to get there which may be useful for getting other help files associated:
Download Process Monitor (currently hosted here: http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx or do a Google search for Process Monitor)
Run Process Monitor with the following filter: 'Process Name' 'is' MSOHelp.exe 'include'
Open object browser in VBA
Choose the library (Scripting in this case)
Choose any function, property, or event in the library and click on the yellow question mark (this should open an empty window with the title Microsoft Visual Basic Help)
Go back to Process Monitor and scroll all the way to the bottom of the list; make sure the Path and Result columns are displayed
There should be dozens of 'PATH NOT FOUND' and 'NAME NOT FOUND' Results in the list. For each one of these results, there should be a corresponding Path where MSOHelp was looking for the help file. Choose any one of these and create a file with that path name. I chose to create a copy of the help file from its original location to the new spot and rename it to match what MSOHelp was looking for.
My best guess is that the scrrun.dll contains the name of the help file and over the years the dll stayed the same but the help file was renamed, modified, etc.