WORKS like a charm......thanks Rolf for your time, patience and examples....Very appreciated....My Final Code
Sub ExistingRecord
Dim objRS6, objEFPageOneControls6, objEditForm6, objSelLayer6
Set objSelLayer6 = Map.SelectionLayer
Set objRS6 = objSelLayer6.Records
objRS6.Bookmark = Map.SelectionBookmark
Set objEditForm6 = application.map.layers("Outfalls").forms("EDITFORM")
Set objEFPageOneControls6 = objEditForm6.Pages("page1").Controls
' Give the user option to add new record on existing feature
Dim YesOrNoAnswerToMessageBox
Dim QuestionToMessageBox
QuestionToMessageBox = "Do you want to enter new data?" & VBNewline & VBNewline & "Are you sure you want to create the historical record now"
YesOrNoAnswerToMessageBox = MsgBox(QuestionToMessageBox, vbYesNo, "VBA Expert or Not")
If YesOrNoAnswerToMessageBox = vbNo Then
' enable the Button to allow the user to create the historical record Onclick
Call EnableButton
Else
'' CALL the function below to clear the form controls.
Set objEditForm6 = Application.Map.Layers("Outfalls").Forms("EDITFORM")
ClearValues objEditForm6
End If
End Sub
Function ClearValues(byRef frm)
' This function activates each page and clears/sets the control values
Dim pControl, pPage
For Each pPage In frm.Pages
pPage.Activate
For Each pControl In pPage.Controls
Select Case pControl.Type
Case "COMBOBOX"
If pControl.ListCount = 1 Then
pControl.ListIndex = 0
Else
pControl.ListIndex = -1
End If
Case "DOMAINFIELD"
If pControl.Name = "Field1" Then
pControl.Value = "NA"
Elseif pControl.Name = "Field2" Then
pControl.Value = "None"
Elseif pControl.Name = "Field3" Then
pControl.Value = "No"
Elseif pControl.Name = "Field4" Then
pControl.Value = "None"
Elseif pControl.Name = "Field5" Then
pControl.Value = "None"
Else
End If
Case "DATETIME"
pControl.Value = Now
'Case "EDIT"
Case "EDIT"
If pControl.Name <> "cbo_User" and _
pControl.Name <> "txtUniqueID" and _
pControl.Name <> "Edit1" and _
pControl.Name <> "Edit9" Then
pControl.Value = "none"
End If
Case "CHECKBOX"
pControl.Value = 0 'False
End Select
Next
Next
frm.Pages(1).Activate
' CleanUp
Set pControl = Nothing
Set pPage = Nothing
End Function