I
ImOkYoureNot
I dont want to use the mailmerge abilities for various reasons.
So I created a recordset using the following commands:
=============================================================
' Connect and select record.
ad
pen ("Provider=MSDASQL.1;Persist Security Info=True;Extended
Properties=""DSN=db;DBQ=C:\vsrep\db1.mdb;DriverId=25;FIL=MS
Access;MaxBufferSize=2048;PageTimeout=5;"";Initial
Catalog=C:\vsrep\db1")
Call rs.Open("SELECT * FROM `wo` where wo=10", ado, adOpenDynamic)
' Now access the data into variables
wo=rs.field("wo")
client=rs.field("client")
====================================================================
Which field can I add to my document to display the data. I tried
using {DOCVARIABLE wo} and {DOCVARIABLE client} but how do I access
them from my VBA code. I would like to have my code figure out which
fields are on the document and populate only those.
E.g. I would like to do something like this (but of course it doesn
work.)
for i=1 to ActiveDocument.Fields.Count
fldName=ActiveDocument.fields(i).name ' no such property
ActiveDocument.Field(fldName).value = rs.field(fldName)
next
Is there an equivalent way?
Thanks
So I created a recordset using the following commands:
=============================================================
' Connect and select record.
ad
Properties=""DSN=db;DBQ=C:\vsrep\db1.mdb;DriverId=25;FIL=MS
Access;MaxBufferSize=2048;PageTimeout=5;"";Initial
Catalog=C:\vsrep\db1")
Call rs.Open("SELECT * FROM `wo` where wo=10", ado, adOpenDynamic)
' Now access the data into variables
wo=rs.field("wo")
client=rs.field("client")
====================================================================
Which field can I add to my document to display the data. I tried
using {DOCVARIABLE wo} and {DOCVARIABLE client} but how do I access
them from my VBA code. I would like to have my code figure out which
fields are on the document and populate only those.
E.g. I would like to do something like this (but of course it doesn
work.)
for i=1 to ActiveDocument.Fields.Count
fldName=ActiveDocument.fields(i).name ' no such property
ActiveDocument.Field(fldName).value = rs.field(fldName)
next
Is there an equivalent way?
Thanks