Skip Headers

Oracle® Objects for OLE Developer's Guide
10g Release 1 (10.1)

Part Number B10118-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Master Index
Master Index
Go to Feedback page
Feedback

Coding the Update Button

See Also
Quick Tour
Employee Form

To code the Update button, we disable the Employee Number text box to disallow changes to this field while updating, since this is a primary key. We also disable the other buttons to disallow other functions such as navigation while updating.

We set the DoUpdate boolean to TRUE, so the commit procedure knows we are updating and not adding a record.

The Update event procedure does the following:

  1. Disables Update button.
  2. Enables the Commit button.
  3. Disables other buttons to disallow functions such as navigation during update.
  4. Disables the Employee Number text box.
  5. Sets the DoUpdate flag to true.
  6. Lets user enter changes.
The Update event procedure looks like:

Private Sub cmdUpdate_Click()

'Disable the Update button and enable the commit button

cmdUpdate.Enabled = False

Commit.Enabled = True

'Disable all other buttons

DisableNavButtons

txtEmpno.Enabled = False

DoUpdate = True

End Sub

The Update and Add event procedures call the DisableNavButtons() subroutine to disable navigation and other functions during an add or update.

Private Sub DisableNavButtons()

'disable all buttons while adding and updating

cmdFirst.Enabled = False

cmdPrevious.Enabled = False

cmdNext.Enabled = False

cmdLast.Enabled = False

cmdFind.Enabled = False

cmdUpdate.Enabled = False

AddNew.Enabled = False

End Sub