Dim lcField As Field 'Declare field object work variable
'/////////////////////////////////////////////////////////////////////
' This loop will copy all the fields in page one over to
' page 2. If a field does not exist, it will be skipped and
' move on to the next one.
'/////////////////////////////////////////////////////////////////////
For Each lcField In Thisform.Pages( "FORM-PAGE1" ).Fields
'/////////////////////////////////////////////////////////////////////
'there is a chance that a field on page 1 is not in the new desired page. This will cause an
'error to occur when the value is copied. We want to ignore this error and continue with the
'other fields. If this error-handling statement is not included, then this page will not print
'out if an error occurs.
'/////////////////////////////////////////////////////////////////////
On Error Resume Next 'ignore errors
'/////////////////////////////////////////////////////////////////////
' OPTIONAL CONDITION: Check if a value has been assigned to the field on the new page. Copy only if nothing is there
'/////////////////////////////////////////////////////////////////////
If ThisForm.Pages("FORM-PAGE2").Fields(lcField.Name + "2").Value = "" Then
ThisForm.Pages("FORM-PAGE2").Fields(lcField.Name + "2").Activate 'activate field (needed if field is graphic)
ThisForm.Pages("FORM-PAGE2").Fields(lcField.Name + "2").Value = lcField.Value 'copy value
End If
Next
Last Modified On:
No, open a new Support Case