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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Access DB with Word Macro

Status
Not open for further replies.

CathieB

Programmer
Feb 21, 2003
13
0
0
US
I am trying to update an open Access DB with information from a MS Word Macro, the problem is that it will not update the field, and I don't know what is the problem. It runs through the whole macro, and does not give me an error message. The following is my code.

Dim DB As database
Dim FndAllTBL, RS, FuntransTbl, FunTBL As recordset
Dim docname As String
Set DB = OpenDatabase(Name:="C:\Documents and Settings\cathie\Desktop\Most Up to date LP LP_Database\LP_Database.mdb")
docname = "#C:\Documents and Settings\cathie\Desktop\Most Up to date LP LP_Database\DOCS" & "-" & Month(Date) & "-" & Day(Date) & "-" & Year(Date) & "-" & Hour(Time) & "-" & Minute(Time) & ".doc#"
Set RS = DB.OpenRecordset(Name:="LtrTrans_tbl")

RS.MoveLast
Letterinfo = docname
RS.Edit
RS.Update

ChangeFileOpenDirectory _
"C:\Documents and Settings\cathie\Desktop\Most Up to date LP LP_Database\DOCS"
ActiveDocument.SaveAs FileName:="Dist" & "-" & Month(Date) & "-" & Day(Date) & "-" & Year(Date) & "-" & Hour(Time) & "-" & Minute(Time) & ".doc", FileFormat:= _
wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles:= _
True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:= _
False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False
ActiveDocument.Close SaveChanges:=False
MsgBox "You have saved your Distribution to the LP Database Docs Folder as" & "Dist" & "-" & Month(Date) & "-" & Day(Date) & "-" & Year(Date) & "-" & Hour(Time) & "-" & Minute(Time) & ".doc"

RS.Close
DB.Close

End Sub

Any help would be greatly appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top