frmEmployees Employee Records Form15& cbPosition tbSSN MaskEdBox ###-##-####( Data1+ Check1 &Active: Data1 Active tbLName Data1* Last Name tbFName Data1* First Name picCommand Command1 E&xit Program cmdedit &Edit Data1% C:\VB\EMPLOYEE.MDB Employees Employees picCommand cmdSave &Save cmdCancel &Cancel lblFields &Position: lblFields &Soc. Sec. No.: lblFields &Last Name: lblFields &First Name: Command1_Click Data1 Recordset Form_Load fLoading cbPosition fEdit@ cbPositon_Change Data1_Validate Action Savek tbSSN Data1_Reposition ListIndex. tbFName_ChangeY tbLName_Change tbSSN_ValidationErrory InvalidText StartPositionu tbSSN_Change PromptInclude picCommand_Click Index lblFields_Click cmdSave_Click cmdEdit_Click cmdCancel_Click` Check1_Click* cbPositon_Click cbPositon_DblClick cbPositon_DragDropp Source Control cbPositon_DragOver State cbPositon_DropDown Enabled cbPositon_KeyDown KeyCode* Shift! cbPositon_KeyPress KeyAscii Caption OldValue Check1~ ValueQ SetTBReadOnlyF tbFName0 tbLNameh cbPosition_DropDown cbPosition_KeyDown cbPosition_KeyPress fProcessing EnableCtls fActivate fEditOnt picCommand Visible cmdEdit Default cmdSave& cmdCancel Cancel TabStop szMask tbPromptIncludeW cmdedit_DragDrop cmdedit_MouseUpw Button cmdedit_GotFocus BkMark Bookmark* tbFName_GotFocus~ SelStart SelLengthS tbFName_LinkCloseh tbFName_LinkError& LinkErr} tbFName_LinkNotify tbFName_LinkOpen? tbFName_LostFocus tbLName_GotFocus tbLName_LinkClose tbLName_LinkError tbLName_LinkNotify tbLName_LinkOpen tbLName_LostFocus tbSSN_GotFocus# tbSSN_LostFocus cbPosition_GotFocus@ cbPosition_LostFocus7 tbFName_KeyDownJ tbFName_KeyPress^ tbLName_KeyDowno tbLName_KeyPress tbSSN_KeyDown tbSSN_KeyPress cbPosition_Change cbPosition_Click cbPosition_DblClick cbPosition_DragDrop cbPosition_DragOver^ Data1_MouseUp Data1_MouseMove Data1_MouseDown5 Data1_ErrorL DataErrp Response Data1_DragOver Data1_DragDrop terminates6 Copyright (c) 1994 by Barth Riley Project Name: Edit Data Demonstration Description: Implements Edit button and read-only controls with a i Data Control Author: Barth Riley Copyright date: Jan 29th, 1994t Version: 1.0 Project file: EDITDATA.MAKe Number of forms: Number of modules: 1 ---Dim Variables Edit mode flagl True when a new rec. is loadedd cbPosition_DropDown Temporarily disable the control cbPosition_GotFocus cbPosition_KeyDown cbPosition_KeyPress cbPosition_LostFocus Check1_Click The Data control will intialize the values of all bound controls prior to the Form_Load event. Hencef both fEdit and fLoading will be False when the Check1 control is initialized. It will "appear" therefore that the user is trying to alter the value of the ckeck box when not in edit mode. To overcome this problem, I've used theTag property of the control to indicate whether the control has been o initialized: If it has no value, then it is set to "Loading". Otherwise, a warning beep is sounded.i Loaded Active cmdCancel_Click Abandon changes to the rec. Back to read-only modet cmdEdit_Click Allow edits cmdSave_Click Update unbound controls Position Back to read-only modet Command1_Click Data1_Reposition Set Mask to field value Set unbound controlsM Position Data1_Validate User moving to a new record We want to prevent the user from moving to a new record when s/he is editing the current record. Cancel move operation allow controls to be updatedt ###-##-#### EnableCtls Set the text box controls to the appropriate edit mode Reset the Mask and text properties for tbSSN ###-##-#### Employee Records [Edit Mode] Employee Records [Read-Only] Set the TabStop values... Make the appropriate command button group visible Set the default and cancel properties for v each set of command buttons ---End of code Form_Load Accountant Consultant Documentation Proofreader Head Honcho Project Manager Programmer Systems Analyst Technical Writer Employee List [Read-only] tbFName_GotFocus tbFName_KeyDown tbFName_KeyPress tbFName_LostFocus tbLName_GotFocus tbLName_KeyDown tbLName_KeyPress tbLName_LostFocus tbSSN_GotFocus tbSSN_KeyDown tbSSN_KeyPress tbSSN_LostFocus