Windows ViSTA - HP Pavilon Entertainement PC (Under windows XP and 2002 IBM PC, no problem)

The problem is I get error 3170 and error 3051 when I define a workspace as I show in the code tested

I need a solution I will appreciate very much.

Where is the code that is giving you trouble? Are you using DAO or ADO, both, or something else? Errors in the 3000+ range are typically error states in the database engine interface, like using invalid parameters or trying to write to a read-only recordset.

Error 3051 means the database already open in an incompatible mode or a file permission problem. If you have read-only access to a database file and you try to open it for full access, this error will be generated. If another process, such as Access, has already opened the database file in exclusive mode then you can not open it. If you try to open the database in exclusive mode, but another process has it open, even in shared mode, would can get this error.

Error 3170 means "Can not find installable ISAM." This is an indicator that your application can not load a required database DLL. This can also indicate that the database file exists, but the connection string is incorrect, so the database engine tries loading an ISAM DLL, but can't find it.

Here is the Code that is giving me trouble in Windows ViSTA - HP Pavilon Entertainement PC (note that works good Under windows XP and 2002 IBM PC).

I am still not seeing your code. Please use the Code button on the editor to include your code in your post. You can copy and paste into this window with the code in question. Also, make sure that you click Insert Code Snippet at the bottom of the window to actually include the code in the posting.

`Inline Code Example Here``

Private Sub Command1_Click()

   m = Val(Text2.Text)

   Dim prest, sp, sh, tp, ch As Variant
   Dim rp, rb, rc, rh, rpg, rcg, rhg, total, cua, vaux, rcup, rcuc, rcuh, rm, rmg, rcum As Double
   Dim dbTDatos As Database
   Dim tbTDatos As Table
   Dim ep, eb, ec, eh, conta, cuenflu, tabt As Integer
   Dim reg, tot As Long
   Dim dbTDatosf As Database
   Dim tbTDatosf As Table

   Dim wspDefa As Workspace               'agregado para resolver problema de ISAM

  ' Actualización de la base de datos a usar

  'Set dbTDatos = OpenDatabase("c:\users\public\Act_2008", False, False, "FoxPro 2.5;")  'sentencia original da error 3170

   Set wspDefa = DBEngine.Workspaces(0)    'agregado para resolver problema de ISAM del error 3051

   'Set dbTDatos = wspDefa.OpenDatabase("c:\users\public\Act_2008", False, False, "FoxPro 2.5;")   'error 3170
   'Set dbTDatos = wspDefa.OpenDatabase("c:\users\public\Act_2008", False, False, "FoxPro 2.5;")   'error 3170

   'Set dbTDatos = wspDefa.OpenDatabase("c:\users\public\Act_2008")                                'error 3051
   'Set dbTDatos = wspDefa.OpenDatabase("c:\users\public\Act_2008", , False, True)                'error 3051
    'Set dbTDatos = wspDefa.OpenDatabase("c:\users\public\Act_2008", , False, False)               'error 3051

       ' el error 3051 dice que c:\users\public\Act_2008 está abierto en modo exclusivo por otro usuario, o bien necesita
  ' permiso par ver sus datos

   'se mueve carpeta a c:act_2008 :

    'Set dbTDatos = wspDefa.OpenDatabase("c:\Act_2008", , False, False)                     'error 3051
     'Set dbTDatos = wspDefa.OpenDatabase("c:\Act_2008", False, False, "FoxPro 2.5;")               'error 3170 !!
      'Set dbTDatos = wspDefa.OpenDatabase("c:\Act_2008", False, False, "Microsoft Visual FoxPro 6.0;")     'error 3170 !!

    'Set dbTDatos = wspDefa.OpenDatabase("c:\Act_2008", , False, False, "Microsoft Visual FoxPro 6.0;") 'error de compilación:
     '                                                    número de argumrntos erróneo o asignación de propiedad no válida.

  Set dbTDatos = OpenDatabase("c:\Act_2008", False, False, "Microsoft Visual FoxPro 6.0;") 'error 3170 err03 3170



    Set tbTDatos = dbTDatos.OpenTable("pen_test") 'este es el dbf que está en c:\users\public\Act_2008 y luego en C:\act_2008
    Inline Code Example Here

`Inline Code Example Here``

`

Inline Code Example Here

Private Sub Command1_Click()

   m = Val(Text2.Text)

   Dim prest, sp, sh, tp, ch As Variant
   Dim rp, rb, rc, rh, rpg, rcg, rhg, total, cua, vaux, rcup, rcuc, rcuh, rm, rmg, rcum As Double
   Dim dbTDatos As Database
   Dim tbTDatos As Table
   Dim ep, eb, ec, eh, conta, cuenflu, tabt As Integer
   Dim reg, tot As Long
   Dim dbTDatosf As Database
   Dim tbTDatosf As Table

   Dim wspDefa As Workspace               'added to resolve error 3170  
  ' Actualización de la base de datos a usar

  'Set dbTDatos = OpenDatabase("c:\users\public\Act_2008", False, False, "FoxPro 2.5;")  'original sentence guves error 3170

   Set wspDefa = DBEngine.Workspaces(0)    'added to resolve error 3170 

   'Set dbTDatos = wspDefa.OpenDatabase("c:\users\public\Act_2008", False, False, "FoxPro 2.5;")   'error 3170
   'Set dbTDatos = wspDefa.OpenDatabase("c:\users\public\Act_2008", False, False, "FoxPro 2.5;")   'error 3170

   'Set dbTDatos = wspDefa.OpenDatabase("c:\users\public\Act_2008")                                'error 3051
   'Set dbTDatos = wspDefa.OpenDatabase("c:\users\public\Act_2008", , False, True)                'error 3051
    'Set dbTDatos = wspDefa.OpenDatabase("c:\users\public\Act_2008", , False, False)               'error 3051

       ' error 3051: c:\users\public\Act_2008 está abierto en modo exclusivo por otro usuario, o bien necesita
       ' permiso par ver sus datos

   'I move folder Act_2008 to c:\  and:

    'Set dbTDatos = wspDefa.OpenDatabase("c:\Act_2008", , False, False)                     'error 3051
     'Set dbTDatos = wspDefa.OpenDatabase("c:\Act_2008", False, False, "FoxPro 2.5;")               'error 3170 !!
      'Set dbTDatos = wspDefa.OpenDatabase("c:\Act_2008", False, False, "Microsoft Visual FoxPro 6.0;")     'error 3170 !!

    'Set dbTDatos = wspDefa.OpenDatabase("c:\Act_2008", , False, False, "Microsoft Visual FoxPro 6.0;") 'error de compilación:
     '                                                    número de argumrntos erróneo o asignación de propiedad no válida.

  Set dbTDatos = OpenDatabase("c:\Act_2008", False, False, "Microsoft Visual FoxPro 6.0;") 'error 3170 



    Set tbTDatos = dbTDatos.OpenTable("pen_test") 'data in pen_test.dbf

    ' ------------
    ' -------------
    Inline Code Example Here

Here is the Code that is giving me trouble in Windows ViSTA - HP Pavilon Entertainement PC (note that works good Under windows XP and 2002 IBM PC).

Unfortunately, I do not know enough about the FoxPro database engine to really help, if that is where the problem is happening. Also, my Spanish(?) is way too weak to read some of your comments meaningfully.

Make sure that FoxPro is installed properly on your computer and that you have set the connection string properly. I think you might be missing some needed information in the connection string; this would cause the Error 3170.

You are reporting error 3051 only on the lines where you leave off the connection string. Make sure the correct connection string is included. Check your documentation of everything that should be included in the connection string to connect to your version of FoxPro.

Thanks very much.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.