?
Solved

Run time error 3051

Posted on 2000-01-08
4
Medium Priority
?
721 Views
Last Modified: 2008-02-26
I need to access a foxpro 2.5 for DOS generated dbf file. I appear to have managed this successfully however when the original dos program that uses these dbf files is running my program comes up with the message:

"THE MICROSOFT JET DATABASE ENGINE CANNOT OPEN THE FILE 'F:\C_IHEAD.DBF'. IT IS ALREADY OPENED EXCLUSIVELY BY ANOTHER USER, OR YOU NEED PERMISSION TO VIEW ITS DATA"
 

My program is written in VB6 and the following section of code is used to extract the recordsets:

Private Function GetData() '(sTable As String)
    Dim sSQL As String
    Dim sData As String
    Dim i As Integer
    Set DB = OpenDatabase("f:\chkprint", True, True, "FoxPro 2.6") ' Workstation home
    sSQL = "Select  ih_account, ih_due, ih_region, ih_route from C_ihead WHERE ih_doc = '" & Text1(0).Text & " '"
    Set rs = DB.OpenRecordset(sSQL, dbOpenSnapshot)
    With rs
        Do While Not .EOF
            Label15.Caption = .Fields(0)
            Label9.Caption = .Fields(1)
            Label24.Caption = .Fields(2)
            Label23.Caption = .Fields(3)
            .MoveNext
        Loop
        .Close
   End With
end sub

How can I access this foxpro 2.6 for DOS file without generating this error.
0
Comment
Question by:wayne_carlisle
  • 3
4 Comments
 

Author Comment

by:wayne_carlisle
ID: 2336021
Edited text of question.
0
 

Author Comment

by:wayne_carlisle
ID: 2336022
Adjusted points to 190
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 760 total points
ID: 2338159
In the OpenDatabase method, the first True is for Exclusive, and the second True is for Read Only.
0
 

Author Comment

by:wayne_carlisle
ID: 2339759
So close yet so far!!
Thanks
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month5 days, 21 hours left to enroll

588 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