sending bookmark data from word 97 to access 97 database 
Author Message
 sending bookmark data from word 97 to access 97 database

I have a template I created in Word 97 using form fields which are
labeled through bookmarks.

I am trying to figure out how to send the data to an access database I
created.

Below is a sample code I was given, however evertime I start the code
up in word 97 I get a compiler error on the second line "dim wrkjet as
workspace"  Can anyone offer any suggetions on how/what I can do to
send the data over.  
Thanks in advance

Sub autoclose()

Dim strdornum As String
Dim wrkjet As Workspace
Dim mydb As database
Dim mytbl As recordsheet

Set thisdoc = ActiveDocument

strdornum = thisdoc.FormFields("dornum").Result

Set wrkjet = createworkspace("", "admin", "", dbusejet)
Set mydb = wrkjet.opendatabase("C:\my documents\dornew")
Set mytbl = mydb.openrecordset("DOR'S")

With mytbl
    .addnew
    !dornum = dornum
    .Update
End With

Set mytbl = Nothing
Set mydb = Nothing
Set wrkjet = Nothing

End Sub



Mon, 31 Jul 2000 03:00:00 GMT  
 sending bookmark data from word 97 to access 97 database

In the VB Editor in Work, check under to Tools | References to be sure
you have a reference to the Microsoft DAO 3.5 Object Library. You
probably don't.

 -- Andy

Quote:

>I have a template I created in Word 97 using form fields which are
>labeled through bookmarks.

>I am trying to figure out how to send the data to an access database I
>created.

>Below is a sample code I was given, however evertime I start the code
>up in word 97 I get a compiler error on the second line "dim wrkjet as
>workspace"  Can anyone offer any suggetions on how/what I can do to
>send the data over.  
>Thanks in advance

>Sub autoclose()

>Dim strdornum As String
>Dim wrkjet As Workspace
>Dim mydb As database
>Dim mytbl As recordsheet

>Set thisdoc = ActiveDocument

>strdornum = thisdoc.FormFields("dornum").Result

>Set wrkjet = createworkspace("", "admin", "", dbusejet)
>Set mydb = wrkjet.opendatabase("C:\my documents\dornew")
>Set mytbl = mydb.openrecordset("DOR'S")

>With mytbl
>    .addnew
>    !dornum = dornum
>    .Update
>End With

>Set mytbl = Nothing
>Set mydb = Nothing
>Set wrkjet = Nothing

>End Sub



Sat, 05 Aug 2000 03:00:00 GMT  
 sending bookmark data from word 97 to access 97 database

Yep, I did not...I have since turned it on, but stil receive the same
error message?  Any idea what to try now?



Quote:
>In the VB Editor in Work, check under to Tools | References to be sure
>you have a reference to the Microsoft DAO 3.5 Object Library. You
>probably don't.

> -- Andy


>>I have a template I created in Word 97 using form fields which are
>>labeled through bookmarks.

>>I am trying to figure out how to send the data to an access database I
>>created.

>>Below is a sample code I was given, however evertime I start the code
>>up in word 97 I get a compiler error on the second line "dim wrkjet as
>>workspace"  Can anyone offer any suggetions on how/what I can do to
>>send the data over.  
>>Thanks in advance

>>Sub autoclose()

>>Dim strdornum As String
>>Dim wrkjet As Workspace
>>Dim mydb As database
>>Dim mytbl As recordsheet

>>Set thisdoc = ActiveDocument

>>strdornum = thisdoc.FormFields("dornum").Result

>>Set wrkjet = createworkspace("", "admin", "", dbusejet)
>>Set mydb = wrkjet.opendatabase("C:\my documents\dornew")
>>Set mytbl = mydb.openrecordset("DOR'S")

>>With mytbl
>>    .addnew
>>    !dornum = dornum
>>    .Update
>>End With

>>Set mytbl = Nothing
>>Set mydb = Nothing
>>Set wrkjet = Nothing

>>End Sub



Sun, 06 Aug 2000 03:00:00 GMT  
 sending bookmark data from word 97 to access 97 database

You can disreguard last post, I did not know I had to exit word for
the change to take effect.  

1 question however.  Do I have to enable this on every computer I put
the template onto?



Quote:
>In the VB Editor in Work, check under to Tools | References to be sure
>you have a reference to the Microsoft DAO 3.5 Object Library. You
>probably don't.

> -- Andy


>>I have a template I created in Word 97 using form fields which are
>>labeled through bookmarks.

>>I am trying to figure out how to send the data to an access database I
>>created.

>>Below is a sample code I was given, however evertime I start the code
>>up in word 97 I get a compiler error on the second line "dim wrkjet as
>>workspace"  Can anyone offer any suggetions on how/what I can do to
>>send the data over.  
>>Thanks in advance

>>Sub autoclose()

>>Dim strdornum As String
>>Dim wrkjet As Workspace
>>Dim mydb As database
>>Dim mytbl As recordsheet

>>Set thisdoc = ActiveDocument

>>strdornum = thisdoc.FormFields("dornum").Result

>>Set wrkjet = createworkspace("", "admin", "", dbusejet)
>>Set mydb = wrkjet.opendatabase("C:\my documents\dornew")
>>Set mytbl = mydb.openrecordset("DOR'S")

>>With mytbl
>>    .addnew
>>    !dornum = dornum
>>    .Update
>>End With

>>Set mytbl = Nothing
>>Set mydb = Nothing
>>Set wrkjet = Nothing

>>End Sub



Sun, 06 Aug 2000 03:00:00 GMT  
 sending bookmark data from word 97 to access 97 database

The reference is stored with the project, so you should be ok, but if
you encounter a problem, you know where to look.

 -- Andy

Quote:

>You can disreguard last post, I did not know I had to exit word for
>the change to take effect.  

>1 question however.  Do I have to enable this on every computer I put
>the template onto?



>>In the VB Editor in Work, check under to Tools | References to be sure
>>you have a reference to the Microsoft DAO 3.5 Object Library. You
>>probably don't.

>> -- Andy


>>>I have a template I created in Word 97 using form fields which are
>>>labeled through bookmarks.

>>>I am trying to figure out how to send the data to an access database I
>>>created.

>>>Below is a sample code I was given, however evertime I start the code
>>>up in word 97 I get a compiler error on the second line "dim wrkjet as
>>>workspace"  Can anyone offer any suggetions on how/what I can do to
>>>send the data over.  
>>>Thanks in advance

>>>Sub autoclose()

>>>Dim strdornum As String
>>>Dim wrkjet As Workspace
>>>Dim mydb As database
>>>Dim mytbl As recordsheet

>>>Set thisdoc = ActiveDocument

>>>strdornum = thisdoc.FormFields("dornum").Result

>>>Set wrkjet = createworkspace("", "admin", "", dbusejet)
>>>Set mydb = wrkjet.opendatabase("C:\my documents\dornew")
>>>Set mytbl = mydb.openrecordset("DOR'S")

>>>With mytbl
>>>    .addnew
>>>    !dornum = dornum
>>>    .Update
>>>End With

>>>Set mytbl = Nothing
>>>Set mydb = Nothing
>>>Set wrkjet = Nothing

>>>End Sub



Mon, 07 Aug 2000 03:00:00 GMT  
 sending bookmark data from word 97 to access 97 database

Me again...sorry to keep asking you the questions but I really need
the help and its very very important.  Now that I got the object
library thing fixed I am getting hung up on this line in the code:

MY ENTIRE CODE IS AT THE BOTTOM OF THIS MSG.....

Set wrkjet = createworkspace("", "admin", "", dbusejet)

I get the error "run time error 429" Activex component can not create
object.  Any thoughts?

I would also like to take this opportunity to ask you about a few
things in the code so I understand it correctly and apply it
right.....

In your sample you have a line that reads

strLName=ThisDoc.FormFields("LastName").Result

I want to confirm what this means.  If I understand it right you are
assigning the form field (bookmark from the form field) "LastName" to
the string "LName"???

Then a few lines down you have

!First = strFName

I think this means you have a field name in Access called "First" and
you are telling it to put "strFName" into the "First" field in your
table?  

Am I getting this?

Thanks again for all your help....

-------------THE WHOLE CODE----------
Sub autoclose()

Dim strdornum As String
Dim strstressdrv As String

Dim wrkjet As Workspace
Dim mydb As database
Dim mytbl As Recordset

Set thisdoc = ActiveDocument

strdornum = thisdoc.FormFields("dornum").Result
strstressdrv = thisdoc.FormFields("stress_driving").Result

Set wrkjet = CreateWorkspace("", "admin", "", dbusejet)
Set mydb = wrkjet.opendatabase("C:\my documents\dornew")
Set mytbl = mydb.openrecordset("DOR'S")

With mytbl
    .addnew
    !dornum = dornum
    !stress_drive = stressdrv
    .Update
End With

Set mytbl = Nothing
Set mydb = Nothing
Set wrkjet = Nothing

End Sub
----------------------



Quote:
>In the VB Editor in Work, check under to Tools | References to be sure
>you have a reference to the Microsoft DAO 3.5 Object Library. You
>probably don't.

> -- Andy


>>I have a template I created in Word 97 using form fields which are
>>labeled through bookmarks.

>>I am trying to figure out how to send the data to an access database I
>>created.

>>Below is a sample code I was given, however evertime I start the code
>>up in word 97 I get a compiler error on the second line "dim wrkjet as
>>workspace"  Can anyone offer any suggetions on how/what I can do to
>>send the data over.  
>>Thanks in advance

>>Sub autoclose()

>>Dim strdornum As String
>>Dim wrkjet As Workspace
>>Dim mydb As database
>>Dim mytbl As recordsheet

>>Set thisdoc = ActiveDocument

>>strdornum = thisdoc.FormFields("dornum").Result

>>Set wrkjet = createworkspace("", "admin", "", dbusejet)
>>Set mydb = wrkjet.opendatabase("C:\my documents\dornew")
>>Set mytbl = mydb.openrecordset("DOR'S")

>>With mytbl
>>    .addnew
>>    !dornum = dornum
>>    .Update
>>End With

>>Set mytbl = Nothing
>>Set mydb = Nothing
>>Set wrkjet = Nothing

>>End Sub



Tue, 08 Aug 2000 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Sending text to Word 97 from Access 97 using OLE automation

2. Sending and manipulating data from Access 97 to Excel 97

3. Insert data from Excel 97 into Word 97

4. Help Needed - Passing Value from Access 97 to Word 97 Macro

5. Access 97 create a Word 97 letter

6. MailMerge from Access 97 to Word 97, value lost

7. Word (97) constants in Access (97)

8. Automation seems to hang with Access 97 / Word 97

9. Saving a Word 97 Document in a Access 97 table

10. Can you pass a table to Word 97 from Access 97

11. Open Word 97 from Access 97 HELP!!!

12. Automation Error when automating Word 97 from Access 97

 

 
Powered by phpBB® Forum Software