Open Word document - ms-access

I found on this forum the solution to open a Word document from Access:
(Opening Word Document using VBA in Access 2013).
button click: Shell "winword ""c:\...\Handout.docx"""
It opens that document. Is there a way to 'popup' it above my Access form?

You must learn to use the documentation and/or IntelliSense for such simple tasks:
Anyway:
Shell "winword ""c:...\Handout.docx""", vbNormalFocus

Related

How to edit and copy non-VBA-macros?

Well, I know, there is a difference between VBA-macros and non-VBA-macros in Access.
Creating and editing of VBA-macros is not very different from Word/Excel: you have a text field, where you can write your code:
But what about editing of non-VBA-macros? For me, it looks like "programming using a mouse-clicking" (for me, as for the new guy in Access, it looks very weird):
Questions:
Is it a common and correct way to edit non-VBA-macros in Access "using a mouse"? Or, probably, there is another way, like shown on the 1st image?
If I have an embedded (as opposed to standalone) non-VBA-macro, how I can copy it from one database to another (or, to Stack Overflow)?
Non-VBA macros should probably not be manually edited.
You can copy the AXL by opening the macro, using Ctrl + A, Ctrl + C, and then pasting it to a text file. This is mainly useful for sharing a macro, because others can paste it, as outlined here: To paste a macro from Stack Overflow into Access.
You can copy and paste the AXL of normal, embedded and data macros. Note that data macros use a different set of functions than normal macros, and the availability differs per event. Normal and embedded macros are compatible.
You can, of course, edit the AXL. But as far as I know, there's no way to edit it from Access, and there's no validation outside of XML validation.
Note that you can convert an Access Macro into its equivalent Visual Basic code using the Convert Macros to Visual Basic option present on the Tools panel of the Macro Tools Design contextual ribbon tab:
This will result in the creation of a VBA Module similar to what may be created when you record a Macro in MS Excel or MS Word.
You can copy a macro from one database to another in the same was as with any other object in Access.
External Data -> New Data Source -> From Database -> Access -> Import

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 popup form refuses to display/not accessible in design mode (but present in list of forms)

Having a problem with MS Access 2007 refusing to display a form in design mode. I can see the code for the form (if I go through the event properties of a button that displays the form), but I cannot see the form laid out as a GUI. And, when I try and invoke this form from the application's main window, it does not display and locks up the whole GUI.
Now, I tried putting debug before and after the display of this form, and the debug does get invoked.
Anyone have any ideas? I tried looking at the Trust Center, and I set "Enable all Macros", but that didn't seem to matter.
A few steps I would take:
Make sure your form has the Auto Center, Auto Resize properties set to Yes.
I had an issue once with forms that opened outside the visible screen, Quite baffling.
Also try to change its PopUp and Modal properties to it becomes just a normal non-blocking form for your tests.
Your database may be corrupted.
Make a copy of your database and then decompile and compact it.
You can do that from the command line, for instance:
"C:\Program Files\Microsoft Office\Office12\msaccess.exe" "D:\Code\mydb.accdb" /decompile /compact
Export the VBA + Form resource, then delete the form from your Access client, then do the decompile+compact above again, then re-import the form.
' Export form and VBA to text files '
Application.SaveAsText acForm, "myForm", "myForm.txt"
' Import form and VBA from text files '
Application.LoadFromText, "myNewForm", "myForm.txt"

access 2007 bug - intermittent query parameter prompts

I am working on an Access 2007 application that was created by someone else. It has a strange, intermittent bug in which it prompts the user for query parameters when the main form is opened. The query parameters are clearly not necessary, because the error does not always occur.
The very strange "fix" to this problem is to open and close a particular module before opening the main form. Then the form opens without parameter prompts. However, of course I can't ask end users to open and close modules.
I tried using a macro to open and close the module when the database is opened. That fixes the bug, but leaves the VBA code window open, so that's no good.
Has anyone run into anything like this before? Any suggested solutions, workarounds, debugging tips, etc?
If you use the "Database Documenter" feature and check "yes" to all the options, you will obtain an exhaustive report that should let you trap your problem parameter. Export this report as an .rtf or .pdf document, so it is searchable. Identify a keyword from the dialog prompt, and search on that.
Once you check the query objects using the Documenter, check your VBA code. You'll do this by stepping through code in the IDE. If the main form has subforms, they are opened with (within) the main form. And they load before the main form.
Identify those subforms.
Sprinkle
breakpoints in their code modules
(if you find a Load function, that
is highly relevant).
If the main form has a
code module, do the same there.
Have a look for global variables in the module that needs to be opened and closed or any variable that is referenced in the module belonging to the form.
Access displays the Enter Parameter Value dialog box when you open an object that contains an identifier or expression that Access cannot interpret. You need to determine the source object. Here's a step-by-step guide:
http://office.microsoft.com/en-us/access-help/why-does-access-want-me-to-enter-a-parameter-value-HA010274377.aspx