472,371 Members | 1,534 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,371 software developers and data experts.

View Word 2007 doc on Access 2007 form

Basic question:
Does anyone know how to go about adding a control to an Access 2007 form that will allow viewing a Word 2007 document?

Reason for asking:
My office is about to receive 100+/- Word 2007 documents that contain data that needs to be imported into various fields of an Access 2007 table. To facilitate the import process, I was thinking of creating a form in Access that would have a Word control (or "window") at the bottom of the form that allows the me to view/preview the Word document. I would then place other "standard" Access controls on the top half of the form that would be bound to my Access table. This way I can use the Word "window" at the bottom of the form to scroll through the document, find the information I want, and then copy/paste the information into the bound controls at the top of the form.

Problem is, I don't know what control to use for my Word "window". I don't see anything suitable in the list of available Active X components.

What I've tried so far:
I already know how to use code to create a new Word object (which launches an instance of Word) and manipulate the Word document. But this doesn't really help me because the Word documents I will receive are coming from various agencies and individuals who will each, I'm sure, edit the document to their liking. Therefore, each document will be unique enough that I can't automate the import process. I need a visual control I can put on a Access form to allow me to see the document and determine where the information is that I want. Kind of like the preview feature in Outlook 2007 that displays Word attachments on the email form.

Of course I could always open the Word and Access applications side by side on my computer and copy/paste the data that I need. But I was hoping to find a more efficient approach since I have so many Word documents to import. At first this seemed like it should be easy to do. But after reading my own post, maybe this is harder than I realized.

Thanks for any help you can offer!
Jul 7 '09 #1
5 9585
675 512MB
I do similar things from email. The simple answer is to either open the 2 applications side-by-side (easier now with "wide-screen" monitors, or copy-paste the word document into your workspace window.

If you copy the text into workspace, you can then 'select' text and using the lostfocus event, save the highlighted text to a variable. When you select a field in your 'upper' space, it could be automatically filled with the saved(selected) text, saving much copy-paste cntl-C ... cntl-V.
Jul 7 '09 #2

First, thanks for taking the time to read and respond to my post.

Second, when you say "workspace window", what kind of control do you have in mind? A regular Access textbox or something else?

The data I want from the Word 2007 files exists in "tables" (i.e. Word tables, not Access tables). If I try to load this information into a regular textbox, all of the table formating (such as the column alignment and background shading) is lost. The information in the table gets smashed together and it's almost impossible to find the information I need. Therefore, a regular textbox wont fit the bill.

I figured there had to be a component/control exposed by Word 2007 already on my computer that I could put on my Access form that would be able to handle all of the Word table formating. Just like there is a "Microsoft Office Spreadsheet 10.0" ActiveX control exposed by Excel to handle spreadsheets, I was looking for something similar for Word. Unfortunately, I don't know where the equivalent Word component is, or what it's called. I thought someone else might be able to tell me.

Perhaps one doesn't exist. However, as I noted in my previous post, Outlook 2007 has a preview feature for Word 2007 files just like I want for my Access form. I just don't know how to crawl inside Outlook to figure out what it's doing so I can replicate it in Access.

Again, any help is greatly appreciated.

Jul 8 '09 #3
675 512MB
Yes, I create an UnBound TextBox on my form. A textbox can hold 4096 characters, I think, and that takes care of most email that I process.
I use the MouseUp Event to do this in the workspace.
Expand|Select|Wrap|Line Numbers
  1. Private Sub txtWorkspace_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  2.     If txtWorkspace.SelLength = 0 Then
  3.         strHold = ""
  4.     Else
  5.         strHold = txtWorkspace.SelText
  6.     End If
  7. End Sub
For each possible target location, I have the following:
Expand|Select|Wrap|Line Numbers
  1. Private Sub txtTarget_GotFocus()
  2.     If strHold <> "" Then
  3.         txtTarget = strHold
  4.         strHold = ""    'Remove this if you want to paste same data into multiple locations
  5.     End If
  6. End Sub
To consider if going this route -
1) Command buttons to a)Clear txtWorkspace, b) Paste to txtWorkspace, c) Clear strHold which is done by clicking txtWorkspace without selecting anything
2) Is the autoClear of strHold desired (Line 4 of GotFocus code, above)
3) Automate selection of target textboxes
3a) Have a list of textboxes to fill from document
3b) On each MouseUp, the next textbox would be filled, without having to click it

I pick through email with these methods quite quickly. The code shown works well where all desired information is not supplied, and some fields may be left blank. If I knew that ALL the data would be available, I would code with 3a, 3b, which isn't much more difficult to do.

I have Access2003, and for your data it will all get "smashed" using my methods. I have read that Access2007 can retain RichText formatting, and so it might be available to you. Whether it preserves the tables well enough, I don't know.

Can you copy the table from Word to Excel, and then import to an Access table? Just a thought.
Jul 8 '09 #4

Again, thanks for your response. I appreciate the time and thought you put into it.

Unfortunately, a textbox just isn't going to work. I did however hit upon what I think will be the solution. It's a bound object frame control (a standard Access control) that I just done bind to a field.

With this control I can temporarily embed my Microsoft Word document into the control and view it just like I was in Microsoft Word. I've still got a view bugs to work out with document navigation and text selection, but this seems to be just what I need.

In addition, the code you provided for the MouseUp and GotFocus events will help streamline the copy/paste operation.

Thanks again for your help.


Jul 13 '09 #5
675 512MB
Glad I could help, even though I didn't know exactly how to solve your problem.
Jul 13 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Simon Pleasants | last post by:
Am something of a newbie at this, so please bear with any stupid questions. I have created a database to track shipments that we import. The information is stored in a table and I have created...
by: Penny | last post by:
Hi All, Is there any way to configure Access/Word so that a user can have an access form(maximized) and word document(size adjusted) visible at the same time to facilitate data input? The size...
by: Darsin | last post by:
What i am doing is to pull the data from a CMS and import it to Word 2007 Beta and i also have to export the data from Word 2007 Beta back to that CMS. We have with us two Web Services of the CMS....
by: Nicolas Boretos | last post by:
Hello, Beginning access user here. I am displaying the table and its existing form at the same time. I would like to double-click on a row in the table and have the form go to/display the...
by: Robertf987 | last post by:
Well, I think I've described what I want to do in the title here. In the database, I have two main tables that contain the main data for the database. One for group expenditures, another for...
by: Esther Lane | last post by:
Hello! First off, many many thanks to Albert who wrote the Mail Merge code for MS Access I am using. It has been working beautifully for a few years. However, my client just (without notice!)...
by: kayberrie | last post by:
I want to write a VBA mail merge code. I want to link the code/macro/dohicky to a nifty little button so it makes life easy. I think I can handle the button part, the code part - not so much. I know...
by: anniebai | last post by:
I am testing a form converted from access 2003 to 2007. This form has two keys (StudentID and ProjectID). if I choose form view, both fields displays. but if in datasheet view, only ProjectID show...
by: Mientje | last post by:
I've made an Access 2007 database to store information about the lessonplans I have to make every schoolyear. I want to export the data form the table "Lesvoorbereiding" (Lessonplans in English) to...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.