Solved

Help with VB6 & ADO & dBase III

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Article by: Leon
Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
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…
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…

726 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