Hello all,
As usual I've managed to copy a function I found on the Internet into my
application and get it to partially work. The problem is that when Access
encounters a field which is empty, it gives me the message "invalid use of
null"-- for example, if the FirstLastName field is empty for a record....
Can someone please tell me what I need to add to the function to allow use
of null values? Here's part of the function below.
Thanks alot!
Lee
Public Function CreateWordLetter(strDocPath As String)
'''if no path is passed to function, exit - no further
'''need to do anything
If IsNull(strDocPath) Or strDocPath = "" Then
Exit Function
End If
Dim dbs As Database
Dim objWord As Object
Set dbs = CurrentDb
'''create reference to Word Object
Set objWord = CreateObject("Word.Application")
'''Word Object is created
With objWord
.Visible = True
.Documents.Open (strDocPath)
'move to each bookmark, and insert text.
.activedocument.Bookmarks("FirstLastName").Select
.Selection.Text = (CStr(Forms![frmmergeIFSP]![Name]))