by Dinesh Thakur Category: DataBase

1. When you want to add new record you have couple of choices. If you are using data control?s navigation buttons, you can allow Visual Basic to do the adds automatically. Set the data control?s EOF action property to


2 – AddNew. When the user moves to end of the file and clicks the arrow buttons, the Update method is automatically executed and the new record is added.


2. You need a different approach when you use code to accomplish record navigation. Assume that you have a command button to menu choice to add a new record. In the click event for the command button use AddNew method:


3. datBooks.Recordset.AddNew


4. When this statement executes, all bound controls are cleared so that the user can enter the data for the new record. After the data fields are entered, the new record must be saved in the file. You can explicitly save it with an update method; or, it the user moves to anther record, the update method is automatically executed.


5. You may want to use two buttons for adding a new record –an Add button and s save button. For the Add button, use an AddNew method; for the Save button, use the Update method.


6. When adding new records, some conditions can cause errors to occur.


7. For example, if the key field is blank on a New record, a run time error holts the program execution.


About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.