Solved

How to Open and Update dbase file?

Posted on 2000-04-24
5
434 Views
Last Modified: 2013-11-24
How to open and update Dbase file in Vb?
0
Comment
Question by:ackid32
  • 3
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
DrMaltz earned 50 total points
ID: 2746164
Why don't you just set up an ADO/ODBC connection to the dbase source..

Here's an example.. to get you started..

    Dim cn As ADODB.Connection
    Dim rs As ADODB.Recordset
   
    Set cn = New ADODB.Connection
   
    'open connection to FOLDER with DBF file
    cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyDirWithData\;Extended Properties=DBase IV"
   
    Set rs = cn.Execute("Select * from Customers")      'name of DBF file here
   
    MsgBox rs.Fields(1).Value
   
    cn.Close
   
    Set cn = Nothing

I hope this information is helpful..
0
 

Author Comment

by:ackid32
ID: 2750038
one problem, i use DAO in my vb so how?
0
 
LVL 3

Expert Comment

by:DrMaltz
ID: 2751752
ackid32.. I apologize.. I just assumed you were using ADO..(Shouldn't do that..)

Yeah.. to do this in DAO.. you'll just need to make sure you referencing the DAO object library.  Also.. I've created an ODBC DataSource via the Control Panel.. ODBC32..  Check it out..

Dim db As Database
Dim ws As Workspace
Dim rst As Recordset
       
Set ws = CreateWorkspace("", "admin", "", dbUseODBC)
       
Set db = ws.OpenDatabase("tbl_emai", _
        dbDriverNoPrompt, False, "ODBC;UID=;PWD=;DSN=Email_dbf;DB=tbl_emai.dbf")
   
       Set rst = db.OpenRecordset("Select EMAIL_ADDR from tbl_emai", dbOpenDynaset)
       
       rst.MoveFirst
       
       With rst
           Do While Not .EOF
            List1.AddItem (rst!EMAIL_ADDR)
            .MoveNext
           Loop
       End With
       
       rst.Close
       db.Close

There's something simple for ya.. Good Luck..
0
 

Author Comment

by:ackid32
ID: 2755592
Thanks,

I am using DAO, How to Update Index files of Dbase?
0
 

Author Comment

by:ackid32
ID: 2769032
ok, thanks
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

The canonical version of this article is on my web site here: http://iconoun.com/articles/collisions/ A companion presentation is available here: http://iconoun.com/articles/collisions/Unicode_Presentation.pdf
As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
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…
Viewers will learn the different options available in the Backstage view in Excel 2013.

747 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

11 Experts available now in Live!

Get 1:1 Help Now