fiesta_rich
04-13-2009, 11:54 PM
hi im setting up a database for a friend of mine who is setting his own business up and i want to transfer data from Access to Word to print an invoice off but i dont want to do it using mail merge I want to do it using VBA as I have done the whole database using VBA can anyone help me??
any help will be brill
rich
ajetrumpet
04-14-2009, 05:55 AM
there is a lot of potential here for anything in either access or word. question is, what is the question?
i like making invoices in access as report objects, but word is also available. if you have to print invoices in batches, you can also do it either way. what exactly are you looking for? do you have images? logos? line items? maybe check this out too... http://www.access-programmers.co.uk/forums/showthread.php?t=137158&highlight=entering+multiple
Mike375
04-14-2009, 06:14 AM
Here is a link to a list of topics/threads in the VBA foruim where both Access and Word is in the thread title
http://www.access-programmers.co.uk/forums/search.php?searchid=3775347
ajetrumpet
04-14-2009, 06:23 AM
or here is a thread where I got Mike out of the jam he was stuck in:
http://www.access-programmers.co.uk/forums/showthread.php?t=156796&highlight=WORD
Hope it wasn't blueberry Mike! That stuff stinks! :D
fiesta_rich
04-14-2009, 10:35 AM
thanks for all the help people
got a problem
Private Sub Transfer_to_Word_Click()
Dim appWord As Word.Application
Dim doc As Word.Document
'Set appWord object variable to running instance of Word.
Set appWord = GetObject(, "Word.Application")
'Make sure you put in the correct path for the CustomerSlip.doc
Set doc = appWord.Documents.Open("F:\Richard's Uni Sept 08-09\BSADC\assignment 3\customeraccesstoword", , True)
doc.FormFields(1).Result = Me.CustomerCodeNo
doc.FormFields(2).Result = Me.CustomerName
doc.FormFields(3).Result = Me.CustomerAddress
doc.FormFields(4).Result = Me.CustomerPostcode
doc.FormFields(5).Result = Me.CustomerTelNo
doc.FormFields(6).Result = Me.CustomerContact
doc.FormFields(7).Result = Me.DeliveryNo
doc.FormFields(8).Result = Me.DriverCodeNo
doc.FormFields(9).Result = Me.CustomerCode
doc.FormFields(10).Result = Me.Pickupdate
doc.FormFields(11).Result = Me.ChargeCode
doc.FormFields(12).Result = Me.Packageweight
doc.FormFields(13).Result = Me.Loadsize
doc.FormFields(14).Result = Me.Distance
doc.FormFields(15).Result = Me.DelivaryCharge
doc.FormFields(16).Result = Me.Chargepermile
doc.Activate
Set doc = Nothing
Set appWord = Nothing
End Sub
when i try and click on the button to active the code this massage comes up
compile error:
user: defined type not defined
please help
fiesta_rich
04-15-2009, 10:46 AM
can any ones help me please as i need to get this nailed as the deadline for me to hand over the system is on friday anyone??
ajetrumpet
04-16-2009, 05:02 AM
what line is highlighted? there are two different ways i've done this, and one may work better for you than the other. give:
1) what line highlighted?
i got the same error.
compile error:
user: defined type not defined
this line is highlighted - appWord As Word.Application
please help.
imdl
vbaInet
02-25-2010, 05:50 PM
Spam reported - xuelanghu521
(http://www.access-programmers.co.uk/forums/member.php?u=75125)