Adding a new record in a VB 4.0 database

Adding a new record in a VB 4.0 database

Question:
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.

 Equip.SetFocus      Data1.Recordset.AddNew      Thermal.Data1.Recordset.AddNew      Contam.Data1.Recordset.AddNew      Data1.Recordset.Update      Thermal.Data1.Recordset.Update      Contam.Data1.Recordset.Update

Answer:
First of all, you have to call the AddNew function before you add your datathrough the bound controls on your form. Most of the forms I saw in theexamples provided by Microsoft had an Add and Update button. To add arecord, you press the Add button, and to save it, you press the Updatebutton. The Add button had the AddNew code in it, and the Update buttonhad the Update code in it. Once you have made that change, you may also have to change the way you arereferencing the Data controls on the other forms. For instance,Therma1.Data1.Recordset.Update may need to becomeTherma1!Data1.Recordset.Update. Try it the way you have it first and if itdoesn’t give you an error, it’s probably ok.

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes