[RESOLVED] Open/read/add data from a DBF File
Hi Everyone,
I need to open a DBF file in vb, read the contents of a column (which is a name of a file), search for that file, and if the file exists or not, place either a yes or no in a new column stating if the file exists or not.
Any suggestions on where to start?
PS...I'm kind of a noob to vb...
Re: Open/read/add data from a DBF File
I dont think that would be a problem if there is an OLEDB Provider for DBF files.
BTW .. what creates a DBF File???
Re: Open/read/add data from a DBF File
Apparently Microsoft Jet Engine 4.0 handles DBF files.
The files hold the non-spatial information from a shapefile from ESRI.
Any suggestions?
Re: Open/read/add data from a DBF File
If the Jet engine handles DBF files then your code could look something like this...
VB Code:
Dim myRecordSet As ADODB.Recordset
Dim MySQL As String
MySQL = "Select File_Column, YesNo_Column FROM yourTable"
Set myRecordSet = New ADODB.Recordset
myRecordSet.Open MySQL, yourConnectionString, ,AdlockOptimistic , adCmdUnknown
While myRecordSet.EOF = False
If Your_Test_For_File_Function(myRecordSet("File_Column")) = True Then
myRecordSet("YesNo_Column") = "YES"
Else
myRecordSet("YesNo_Column") = "NO"
End if
myRecordSet.UpDate
myRecordSet.MoveNext
Wend
myRecordSet.Close
Re: Open/read/add data from a DBF File
Works great, thanks a bunch!!