Solved

Help with VB6 & ADO & dBase III

Posted on 2001-08-19
4
1,198 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
[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
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
This collection of functions covers all the normal rounding methods of just about any numeric value.
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 create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

739 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