It is called after the record is updated, resetting the input fields so new data can be entered. Aspects of the code may be useful if you want to do more than a simple search.
It is designed to work by passing a parent container such as a panel or frame, rather than a Form...
As I utilise single form maintenance rather than one form for displaying & selecting the records and another to do the maintenance so the controls to enter/update data exist on a panel/frame which I set visibility as required.
Public Sub FormResetControls(InControl As Container)
Dim ControlElement As Control
Dim TmpInt As Integer
Dim TPanel As TabPanel
Dim TStrip As TabStrip
Dim EmptyString As Variant = ""
For Each ControlElement In InControl.Children
If ControlElement Is Frame Then FormResetControls(ControlElement) 'It may have children so do a recursive search
If ControlElement Is Panel Then FormResetControls(ControlElement) 'It may have children so do a recursive search
If ControlElement Is TabPanel Then
TPanel = ControlElement
For TmpInt = 0 To TPanel.Count - 1
FormResetControls(TPanel[TmpInt]) 'It may have children so do a recursive search
Next
Endif
If ControlElement Is TabStrip Then
TStrip = ControlElement
For TmpInt = 0 To TStrip.Count - 1
FormResetControls(TStrip[TmpInt]) 'It may have children so do a recursive search
Next
Endif
If ControlElement Is TextBox Then Object.SetProperty(ControlElement, "Text", EmptyString)
If ControlElement Is TextBox Then Object.SetProperty(ControlElement, "Background", Color.White)
If ControlElement Is TextArea Then Object.SetProperty(ControlElement, "Text", EmptyString)
If ControlElement Is TextEditor Then Object.SetProperty(ControlElement, "Text", EmptyString)
If ControlElement Is ValueBox Then Object.SetProperty(ControlElement, "Value", Null)
If ControlElement Is CheckBox Then Object.SetProperty(ControlElement, "Value", 0)
If ControlElement Is DirBox Then Object.SetProperty(ControlElement, "Path", EmptyString)
If ControlElement Is ComboBox Then
If Object.GetProperty(ControlElement, "Count") > 0 Then Object.SetProperty(ControlElement, "Index", 0)
Endif
If ControlElement Is SpinBox Then
TmpInt = Object.GetProperty(ControlElement, "MinValue")
Object.SetProperty(ControlElement, "value", TmpInt)
Endif
Next
Catch
Message(Error.Text & Gb.CrLf & Error.Where)
End