Solved

How to Open and Update dbase file?

Posted on 2000-04-24
5
438 Views
Last Modified: 2013-11-24
How to open and update Dbase file in Vb?
0
Comment
Question by:ackid32
[X]
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
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
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…
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…

730 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