Freetutes.com

VB6 beginners tutorial - Learn VB6

Advanced VB6 tutorial - Learn Advanced VB6

Systems Analysis - System analysis and Design tutorial for Software Engineering


You are here: Visual Basic > Advanced VB6 tutorial > Chapter 8

Adding Records With the ADO Data Control in Visual Basic 6 (VB6)

The user can view records and even write changes back to the data by just moving the record pointer.

To enable the user to add new records, you can do this:

  • Set the Data Control's EOFAction property to 2- DoAddNew. You can set this at design time in the Properties window or in code using the internal constant adDoAddNew. The user will see and be able to edit a temporary blank record when there is an attempt to move past the last record in the Recordset.

  • Call the Recordset's AddNew method programmatically to add a record. AddNew blanks out the fields in the record buffer and refreshes the bound controls accordingly. The user sees the blank controls and can edit the fields of the potential new record (see Figure 8.23).

    What the user will see at the end of file with the ADO Data Control's EOFAction property set to adDoAddNew, or when you call the AddNew method in code
    FIGURE 8.23 What the user will see at the end of file with the ADO Data Control's EOFAction property set to adDoAddNew, or when you call the AddNew method in code.

After the user has edited the originally blank copy buffer in either of these scenarios, the record must be saved in one of two ways:

  • The user must move the record pointer.

  • You can programmatically call the Update method.

See Also


  

<< Previous | Contents | Next >>

Home | About Us | Privacy Policy | Contact Us

Copyright © Freetutes.com | All Rights Reserved