Import Empty Field

Klion

Registered User.
Local time
Yesterday, 22:23
Joined
Jul 12, 2004
Messages
16
I have some code to import data from MS word fields to a table in my database, however I've run into a little snag.

The problem is that some of these fields will be empty. So I have code trying to import empty fields which spits out an error (Case 5941: The requested member of the collection does not exist)

What I need is a way to check if the field is empty before I try to use it, for example I tried

Code:
 If Not doc.FormFields("Email").Result = "" Then
    !Email = doc.FormFields("Email").Result
    End If

but of course any attempted use of doc.FormFields("Email").Result causes the same problem. How can I check the field, or make the program ignore that error?
 
Klion,

You can do a couple of things here:

Code:
If Not doc.FormFields("Email").Result = "" Then
    !Email = doc.FormFields("Email").Result
Else
    !Email = "SomethingElse"
End If

or ...

!Email = Nz(doc.FormFields("Email").Result, "SomeThingElse")

Wayne
 
Bah I figured it out now. It seems the problem was not what I thought it was, heh. Thanks :/
 
Last edited:

Users who are viewing this thread

Back
Top Bottom