I figured out a quick and easy solution:Sub InitialiseGPSID
'Do any form initialization in this sub
Dim objEFPageOneControls, objEditForm
Set objEditForm = ThisEvent.Object
Set objEFPageOneControls = objEditForm.Pages("PAGE1").Controls
'Initialization for form in any mode
'Disable the GPS ID edit box
objEFPageOneControls("txt_GPSID").Enabled = False
'Initialization for form when adding new records
If objEditForm.Mode = 3 Then ' Mode 3 is used when creating a new feature.
'Get the Fence Points layer's recordset (to pass into the ReturnNextID function)
Dim objUniqueID
Set objUniqueID = Layer.Records
if ReturnNextID (objUniqueID, "USERNUMBER") = 1 then
'Update the Tree ID
objEFPageOneControls("txt_GPSID").Value = ReturnNextID (objUniqueID, "USERNUMBER") + 10000
objEFPageOneControls("txt_AssetID").Value = ReturnNextID (objUniqueID, "USERNUMBER") + 10000
else
objEFPageOneControls("txt_GPSID").Value = ReturnNextID (objUniqueID, "USERNUMBER")
objEFPageOneControls("txt_AssetID").Value = ReturnNextID (objUniqueID, "USERNUMBER")
end if
End If
'Free objects
Set objEFPageOneControls = Nothing
Set objEditForm = Nothing
Set objUniqueID = Nothing
End Sub
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
'Also write the function ReturnNextID that is called by InitializeForm.
Function ReturnNextID (objRS, strFieldName)
Dim intMax
'Get the first record
objRS.MoveFirst
'Initialize the max value to the first record
intMax = CInt(objRS.Fields(strFieldName).Value)
'Loop through the records, updating the max value if necessary
Dim intCurrVal
While Not objRS.EOF
intCurrVal = CInt(objRS.Fields(strFieldName).Value)
If (intCurrVal > intMax) Then
intMax = intCurrVal
End If
objRS.MoveNext
Wend
ReturnNextID = intMax + 1
End Function
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
The text in the yellow links to a invisible text box in the form then saves the value to the field in the Shapefile.not a clear work around but does for now.Cheers