?
Solved

Insert Info from Access Database in Word though a Word-macro (VBA)

Posted on 1997-09-21
14
Medium Priority
?
419 Views
Last Modified: 2012-06-27
Is it possible to lookup some information in an Access database, let say an address and insert it in a Word using a word-basic Macro? I cannot find info on this in the Word- or VBA-helpfiles.
0
Comment
Question by:edogroen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 4
  • +1
14 Comments
 
LVL 1

Expert Comment

by:Chrrris
ID: 1956570
Yes, it is possible!

I am working on an application that requires something
similar to this. I need to keep track of, open, and access
information (such as the document title) in word documents.

If you are interested, I can give you a code example that
sends an Word fax from Access.

0
 
LVL 1

Expert Comment

by:BBC
ID: 1956571
I would be interested :-)

to edogroen: which verisons are you using ?
0
 
LVL 1

Expert Comment

by:BBC
ID: 1956572
OOOOPS ! I'm sorry ! This should me a comment not a proposed answer .. deny it please !
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

Author Comment

by:edogroen
ID: 1956573
BBC: I use Office'95. So Version 7 of both programms.

Chrrris: I am not sure if that is the same. I want to import a single address from Access in Word using a Word-macro. I think you make a Word-document from Access. As far as I tried the VBA-commands for using Access use (from Word) don't work. In the Word-helpfiles there is no VBA-info for doing this. Only the Mailmerge option. I hope that what I wrote here makes sence!?!
0
 
LVL 1

Expert Comment

by:BBC
ID: 1956574
Please rate my "answer" with the lowest possible rating (think its E) so someone other can give you a real answer, please !

OK, Acces is NO OLE Server ! That means that you can't access to Access from the outside ! Do not blame me .. you know who to blame ...
The only way would be, that you start Access, which automatically starts its own makro and waits for signal from word for executing a special action, which has to be programmed in Access. Sorry, I think there is no other way !
If this way may be good for you, tell me, I'll try a little. But can you start Access from Word ?
Ahhh, now I have another idea !
With the /x option you can execute a macro in Access, so you could easily "trigger" that action you want to have done from the outside.
Need an example ?

0
 
LVL 1

Expert Comment

by:Chrrris
ID: 1956575
Uhhh. You are right, edogroen. I am trying to do the opposite!

BBC, I think it IS possible to retrieve information from Access via word macros. How come you believe this isn't the case?


0
 

Author Comment

by:edogroen
ID: 1956576
BBC: OK I rejected your answer. I will think about you option, but it sounds complicated to it that way and it will slowdown do process since you _have_ to start Access.

Chrrris, any idea how?
0
 
LVL 1

Expert Comment

by:BBC
ID: 1956577
Both:
Okay, I only have Access 97 handy. So I looked in the documentation there. I found something really new. It wasn't there in Access 2, so perhaps its already there in 95 ?

In 97 you should be able to open Access and access the forms and reports. Over DBEngine you probably will be able to access the tables and their contents .. is that what you wanted ??

Here is the beginning:  

Dim appAccess As Object
Set appAccess = CreateObject("Access.Application.8")    
                                   Use 7 here ^^^^^^^ ????
appAccess.OpenCurrentDatabase "myData.mdb"
...


If you can find these methods in Access 95 and get this little bit of code above running, I will program the rest for you ...
L8ter!
0
 
LVL 1

Expert Comment

by:Chrrris
ID: 1956578
See? I knew it was possible ;)z-<
0
 
LVL 1

Expert Comment

by:BBC
ID: 1956579
:))) Chrrrris, can U test the code above in Office 95 ? Do you have that ?
0
 
LVL 1

Expert Comment

by:Chrrris
ID: 1956580
Sorry mate, I only have Access 97.
0
 

Author Comment

by:edogroen
ID: 1956581
Hej,

The code above doesn't work in Office'95. I think I have to wait untill we upgrade to Office'97. Or I have to use a normal textfile as my database. Just open this file and read the contents. It is not like I want it but it is an alternative to consider.

Thanx so far.
Edo
0
 
LVL 1

Accepted Solution

by:
mikkon earned 30 total points
ID: 1956582
You can't do such a link in Word 95 (as the previous comments have revealed). Word 95 does NOT allow you to write VBA, only WordBasic. With VBA you could implement the link easily, and Word 97 does support VBA. Once you have Word 97, be sure to install DAO (Data Access Objects) and start searching the help for keywords like DBEngine, OpenDatabase and OpenRecordset, for starters.


0
 

Author Comment

by:edogroen
ID: 1956583
Thanx,

That is what I basicly already knew. But thanx anyway for the exact explanation and the info on Word 97.

Bye,
Edo
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question