I am certain this has already been answered and please forgive my newb status. I am able to export data to a word document. I have a form to create a profile, I use that profile to create an ID Card. Everything works fine until a file is blank in access. The word document is still created however I get a message in access "Run-Time error '94': Invalid use of Null. I would like to have access ignore the blank field so I dont get the error. There are at times the information is not required to be exported. Below is my VB, again I am very new to access but realize the potential of using this software. any help would be greatly appreciated.
Private Sub CCSOFC_Click()
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim filepath As String
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Open("CCSOFC.doc", , True)
With doc
wrdDoc.FormFields("Rank").Result = (Me!Rank)
wrdDoc.FormFields("Name").Result = (Me!Name)
wrdDoc.FormFields("CertNumber").Result = (Me!CertNumber)
wrdDoc.FormFields("Agency").Result = (Me!Agency)
wrdDoc.FormFields("ContactNumber").Result = (Me!ContactNumber)
wrdDoc.FormFields("IssueDate").Result = (Me!ORDate)
wrdDoc.FormFields("ExpDate").Result = (Me!ExpDate)
wrdApp.Visible = True
wrdApp.Activate
End With
Set doc = Nothing
Set appWord = Nothing
Exit Sub
errHandler:
MsgBox Err.Number & ": " & Err.Description
End Sub