Solved

Help with VB6 & ADO & dBase III

Posted on 2001-08-19
4
1,192 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 300 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
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 use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

828 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