Solved

database acces with vb 6.0

Posted on 2000-04-10
3
152 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
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
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…

785 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