Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to Open and Update dbase file?

Posted on 2000-04-24
5
Medium Priority
?
441 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 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
   
    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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Microsoft's Excel has many features that most people will never need nor take advantage of.  Conditional formatting is one feature that you may find a necessity once you start using it.
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 simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…

916 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