Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


How to Open and Update dbase file?

Posted on 2000-04-24
Medium Priority
Last Modified: 2013-11-24
How to open and update Dbase file in Vb?
Question by:ackid32
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
  • 2

Accepted Solution

DrMaltz earned 150 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
    Set cn = Nothing

I hope this information is helpful..

Author Comment

ID: 2750038
one problem, i use DAO in my vb so how?

Expert Comment

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)
       With rst
           Do While Not .EOF
            List1.AddItem (rst!EMAIL_ADDR)
       End With

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

Author Comment

ID: 2755592

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

Author Comment

ID: 2769032
ok, thanks

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

We were having a lot of "Heartbeat Alerts" in our SCOM environment, now "Heartbeat" in a SCOM environment for those of you who might not be familiar with SCOM is a packet of data sent from the agent to the management server on a regular basis, basic…
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

705 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