Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export to Word

Status
Not open for further replies.

telande35

Programmer
Nov 27, 2004
24
BE
Hey,

I have no experience in VBA.

I have one table in Access 'Persons'. Each Person has two links to a person in the same table to the father and to the mother.

Now I have to make a print of the antecedents (4 grades) of a specified person in following way.

Person7:Father of person2
Person2: Father of person1
PersonX:Mother of person2
Person1
PersonT:Father of person3
Person3: Mother of person1
PersonN:Mother of person3

I made a form where I can put in the specified person an a print button.
Then I will open WORD as follows

Dim strfilename As String
Dim wrd As Object
Dim wrd1 As Object
strfilename = "path to file"
Set wrd1 = CreateObject("word.application.9")
Set wrd = GetObject(, "Word.Application.9")
wrd.Visible = True
wrd.Documents.Open strfilename, , True
wrd.Activate


But now How can I give the data to word ? Do I have too work with bookmarks,...

I have now idea how I can make such a word document with the data of acess table 'Person'.

Is there somebody that can direct me in the right way, or have some idea's ??

Thanks in advance,
nic







 
Hi.
Why not create an Access report instead of exporting to Word which is based on the form that contains the data?
Regards
I
 
Thanks Inky.

So, now I created a report with several texboxes

I think when I open the report I ask for a personid.

So, I started a 'Event Procedure' on OnOpen

Here I have to excecute some queries like :
select id as id1, name from person where id = parameter.

And I will bind the name to textbox1.

Then next query : select id, name from person where idfather = id1 or idmother = id1.
Then I have to bind the names to other textboxes.

How can I bind this data to the textboxes.
And how can I execute the queries?

Thanks for help.
nic

 
I tried in the VBA (just for testing, it is not the query output.

Me.Text2= "NAAM"

but i receive follwing error
You can't assign a value to this object (2448)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top