Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Mar 3, 1997



Application Security Testing: An Integral Part of DevOps

Adding a new record in a VB 4.0 database

When I use my add record button on my form I get blank fields, like I should. However, after I add the new info and move to a different record I find that my new record has overwritten an existing record. I am trying to use the AddNew and Update methods without success. Any advice? Here is the code in the click event of my add button. The info must change on 3 forms.

First of all, you have to call the AddNew function before you add your data through the bound controls on your form. Most of the forms I saw in the examples provided by Microsoft had an Add and Update button. To add a record, you press the Add button, and to save it, you press the Update button. The Add button had the AddNew code in it, and the Update button had the Update code in it. Once you have made that change, you may also have to change the way you are referencing the Data controls on the other forms. For instance, Therma1.Data1.Recordset.Update may need to become Therma1!Data1.Recordset.Update. Try it the way you have it first and if it doesn't give you an error, it's probably ok.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date