Saving calculated field results.....a newbie question!

S

S Kahn

Reviewing the posts I realize it is not possible to save results of a
calculated field in a table. Besides I understand it is not a good practise
either. However my dilemma is that I want to use the result of a calculated
field in a Word document (using mail merge). Since the result is not stored
in a table, I am at a loss as to how to do so. Any suggestions would be
greatly appreciated (pls. remember my newbie handicap).
Thanks in anticipation,
SK
 
D

Douglas J. Steele

It all depends on how the calculation is derived. If it's a fairly
straightforward one, you can add it as a calculated field in a query and use
the query with your mail merge instead of a table.
 
O

Ofer

First, it is possible to store calculated result, but it's not recomanded.
To pass values to a word document, if you want to consider using bookmarks
then try this

Create reference to microsoft word, when you view code > select tools >
refernce and add from the list Microsoft Word
Then create A word document, insert book marks where you want the value from
access should be insert, and then run this code

Public Sub PrintToWord()
Dim wd As Word.Application
Dim myDoc As Word.Document

Set wd = New Word.Application
wd.Documents.Add DOTpath & reportName & ".dot" ' The name and path
Set myDoc = wd.ActiveDocument
With wd.Selection
.GoTo wdGoToBookmark, Name:=BookMarkName ' The name of the book
mark
.Font.Bold = True ' You can choose if bold
.Font.Underline = False ' or underline
.TypeText Text:=ValueToInsertInTheBookMark ' insert values
End With
wd.Visible = True

End Sub
 
S

S Kahn

Thanks for the advice. The calculation I put in the query is:
Datediff("d",[DOB],Now()) where [DOB] is another field with the date of
birth. However it does not seem to work despite many pertubations that I
tried.
Again thanks for your help.
SK
 
S

S Kahn

Ofer said:
First, it is possible to store calculated result, but it's not recomanded.


Firstly, thanks for the advice. You suggested that it is possible to pass
results from a calculated field to a table (though not recommended).
Appreciate if you could advise how I could do that.
SK
 
Top