Solved

Record exists?

Posted on 1998-09-18
2
142 Views
Last Modified: 2010-04-30
I'm working with a Visual Basic app that needs to update data in an Access database.  Everything works fine, but how do you do a routine like the following:

If a record exists then
    update a field in the existing record
Else
    insert record with appropriate data
End If

By the way, I'm not using the Data control - I just want to use statements through the Jet engine.

Thanks
0
Comment
Question by:IsleOfView
2 Comments
 

Author Comment

by:IsleOfView
ID: 1435584
Edited text of question
0
 
LVL 8

Accepted Solution

by:
MikeP090797 earned 40 total points
ID: 1435585
Assuming the table has Name field

rs.FindFirst("Name=MyName")
if rs.NoMatch() then rs.AddNew else rs.Edit
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now