?
Solved

Help with VB6 & ADO & dBase III

Posted on 2001-08-19
4
Medium Priority
?
1,207 Views
Last Modified: 2013-11-24
There seems to be a real shortage of information on using dbase with VB6.  I assume that MS does not want anyone using dBase.  I would like that also, but at this time, that is not possible for what I need to do.  I have a very large system that is using dBase III files and I have no choice.  I am looking for help and/or sample code that uses VB6 and dbase. Every time I get past one problem, I manage to find another one.  I would like to give someone 1000 points for some good advice and sufficient sample code to help me get the job done. Here is the code that is giving me the most current problem.


I have a ORDERS.INF file with this in it:

[dBase III]
NDX1=ORD_NUM.NDX

[UIDX1 ORDER_NUM]

ord_num.ndx is the index name and order_num is the field that it is indexed on.

I get the following error when executing the code below

Run-time error 3251':

Current provider does not support the necessary interface for Index functionality.



Set cOrders = New ADODB.Connection

cOrders.ConnectionString = "Driver={Microsoft dBASE Driver (*.dbf)};DriverID=21;Dbq=u:\drs\data"

cOrders.Open

Set rsOrd = New ADODB.Recordset

rsOrd.Open "SELECT * FROM ORDERS.DBF ", cOrders,adOpenForwardOnly, adLockOptimistic, adCmdText

rsOrd.Index = "u:\drs\data\ORD_NUM.ndx"



0
Comment
Question by:mikelpg
  • 2
4 Comments
 
LVL 14

Accepted Solution

by:
wsh2 earned 1200 total points
ID: 6404668
This is double posted.. see:

http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20170586

for earlier discussions.

0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6404678
I think the error message is quite self-explanatory.  In any case you cannot set an index with the provider and type of recordset you are using.  Certainly you can never set an index to a recordset that is a Select statement, even with those providers such as Jet 4.0 (with Access 2000) that do support this property.

So if you really need to set this property you need to change your code to:

rsOrd.CursorLocation = adClient
rsOrd.Open "ORDERS.DBF ",cOrders,adOpenForwardOnly, adLockOptimistic, adCmdTableDirect

Debug.Print rsOrd.Suports(adIndex)

This will tell you if it is going to work.

I believe there are better ways of skinning this cat, but I will need more information.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6404681
Oops I will repost in that thread.
0
 
LVL 2

Expert Comment

by:idorey
ID: 6405225
Posted to both Threads

Add the dbase files as ODBC datasources and then connect to them?

Good Luck
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

862 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