Solved

database acces with vb 6.0

Posted on 2000-04-10
3
156 Views
Last Modified: 2010-05-02
on a form, Insert, modify and delete a record on a dbf table with ADODC ( i will apreciate to receive the code to know how to do it!!)
0
Comment
Question by:poirier_i
[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
3 Comments
 

Author Comment

by:poirier_i
ID: 2701510
Adjusted points from 15 to 50
0
 
LVL 9

Expert Comment

by:samopal
ID: 2701725
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset

cn.Open "DSN=Visual FoxPro Tables;UID=;PWD=;SourceDB=d:\My Work;SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;Deleted=Yes;"
rs.Open "select * from test", cn

' Add new record
rs.addnew
rs.fields(0)=122
rs.fields(1)="xxx"
rs.update

'Edit record
rs.fields(0)=133
rs.update

'Delete record
rs.delete
rs.update

PS Test.dbf is a table in d:/My Work directory

HTH
0
 

Accepted Solution

by:
gfaucher earned 50 total points
ID: 2703533
it might be this kind of code. if your ADODC is on the form.

'to insert
adodc.recordset.addnew
adodc.recordset.field(0) = String 'or
adodc.recordset.field("Fieldname") = string
adodc.recordset.update

'to edit
adodc.recorset.field(0) = string
adodc.recordset.update

'to delete
adodc.recordset.delete
adodc.update

and if you want your modification to be visible put adodc.refresh after your update
0

Featured Post

Industry Leaders: 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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

726 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