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
Solved

How to Open and Update dbase file?

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

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
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

860 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