Null Values in Form Fields 
Author Message
 Null Values in Form Fields

I am using Word 2000 and am creating a fill-in form.

I have a 4 fill-in text fields where the latest value
needs to be automatically filled in elsewhere (a cross-
reference to a bookmark; currently bookmark 1) in the form.

What I am trying to do is this:

If field 4 has no data, then I want the value of field 3
returned.  If field 3 has no data, then I want the value
of field 2 returned.  If field 2 has no data, then I want
the value of field 1 filled in.

Any help is appreciated!



Tue, 02 Aug 2005 00:10:42 GMT  
 Null Values in Form Fields
Hi Robin,

You could do it with nested IF fieldcodes but ...

What happens when: Fld1 filled, Fld2 & Fld3 are empty and Fld4 is filled?

Or another one:
What happens when Fld1 is empty, Fld2 is filled, Fld3 is empty and Fld4 is
filled?
According to yr wishes, in the second exmple y'd wind up getting Fld1: empty
Fld2 filled and Fld3 filled with contents of Fld4 and of course, Fld4 wud be
empty ...
I don't think you wud want that.

Here's an example in VBA to make 4 (or multiple) FormFields 'rangeup'
(vertically) contiguous.

Sub MakeContiguous()
On Error GoTo getout
With ActiveDocument.FormFields
    For x = .Count To 1 Step -1
        For y = x - 1 To 1 Step -1
            TestAndSwap .Item(y), .Item(x)
        Next
    Next
End With
ExitHere:
Exit Sub
getout:
Resume ExitHere
End Sub

Sub TestAndSwap(ByVal f1 As FormField, ByVal f2 As FormField)
    If f1.Result = "" And f2.Result <> "" Then
        f1.Result = f2.Result
        f2.Result = ""
    End If
End Sub

Krgrds,
Perry



Quote:
> I am using Word 2000 and am creating a fill-in form.

> I have a 4 fill-in text fields where the latest value
> needs to be automatically filled in elsewhere (a cross-
> reference to a bookmark; currently bookmark 1) in the form.

> What I am trying to do is this:

> If field 4 has no data, then I want the value of field 3
> returned.  If field 3 has no data, then I want the value
> of field 2 returned.  If field 2 has no data, then I want
> the value of field 1 filled in.

> Any help is appreciated!



Tue, 02 Aug 2005 05:46:39 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. adodb connection to excel: recordset.fields(i).value=null for fields with numeric value

2. adodb connection to excel: recordset.fields(i).value=null for fields with numeric value

3. adodb connection to excel: recordset.fields(i).value=null for fields with numeric value

4. doesn't recognize Null value from a field value

5. NULL VALUES IN DATE FIELD - TYPE MISMATCH ERROR

6. Null value in a Numeric field

7. Null values in numeric fields

8. SQL Error writing null value field

9. Yes/No field - Null values?

10. Null to Zero field values

11. Set Field Value to Null, How to.

12. Test for null value in Outline code field

 

 
Powered by phpBB® Forum Software