Solved

Record exists?

Posted on 1998-09-18
2
146 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

756 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