Solved

Help with VB6 & ADO & dBase III

Posted on 2001-08-19
4
1,182 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
Comment Utility
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
Comment Utility
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
Comment Utility
Oops I will repost in that thread.
0
 
LVL 2

Expert Comment

by:idorey
Comment Utility
Posted to both Threads

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

Good Luck
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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 …
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now