Solved

How to Open and Update dbase file?

Posted on 2000-04-24
5
436 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

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

The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

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