Connection to Open Directory Tables 
Author Message
 Connection to Open Directory Tables

I have to connect to a table to update its contents but
can't seem to be able to.

I get ODBC driver does not support the requested
properties.

After removing the recordset's property

rs.CursorType = adOpenKeyset

it returns that can't find the table

This is my code just in case it helps.

Thanks!

'===================================================

Dim VFPFrom As New ADODB.Connection
Dim cmdFromDB As New ADODB.Command
Dim recFromDB As New ADODB.Recordset

MasterConnFrom = "Driver={Microsoft Visual FoxPro
Driver};UID=;SourceDB=" & cboFrom
& ";SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate
=Machine;Null=Yes;Deleted=Yes;"

'Set Connection Properties
With VFPFrom
    .ConnectionString = MasterConnFrom
    .Open
End With

'Set Commandn Properties
With cmdFromDB
    .ActiveConnection = VFPFrom
    .CommandText = "select * from jtm1000 order by empl"
    .CommandType = adCmdText
End With

'Set Recordset Properties
Set recFromDB.Source = cmdFromDB

With recFromDB
    .CursorType = adOpenKeyset 'When I remove this
                               'property it can't find
                               'the table    
    .Open
    If Not .EOF Then
        Do While Not .EOF

            empl = .Fields("empl")
            punches = .Fields("punches")
            ecnts = .Fields("ecnts")
            pcnts = .Fields("pcnts")
            tcnts = .Fields("tcnts")

            'Some code goes here

            .MoveNext
        Loop

        MsgBox "All Done", vbInformation, App.Title
    Else
        MsgBox "No records to show", vbCritical, App.Title
    End If
    .Close
End With
'==========================================================



Tue, 06 Sep 2005 02:14:57 GMT  
 Connection to Open Directory Tables
Shouldn't that be
      punches = .Fields("punches").Value
-Anders


Quote:
> I have to connect to a table to update its contents but
> can't seem to be able to.

> I get ODBC driver does not support the requested
> properties.

> After removing the recordset's property

> rs.CursorType = adOpenKeyset

> it returns that can't find the table

> This is my code just in case it helps.

> Thanks!

> '===================================================

> Dim VFPFrom As New ADODB.Connection
> Dim cmdFromDB As New ADODB.Command
> Dim recFromDB As New ADODB.Recordset

> MasterConnFrom = "Driver={Microsoft Visual FoxPro
> Driver};UID=;SourceDB=" & cboFrom
> & ";SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate
> =Machine;Null=Yes;Deleted=Yes;"

> 'Set Connection Properties
> With VFPFrom
>     .ConnectionString = MasterConnFrom
>     .Open
> End With

> 'Set Commandn Properties
> With cmdFromDB
>     .ActiveConnection = VFPFrom
>     .CommandText = "select * from jtm1000 order by empl"
>     .CommandType = adCmdText
> End With

> 'Set Recordset Properties
> Set recFromDB.Source = cmdFromDB

> With recFromDB
>     .CursorType = adOpenKeyset 'When I remove this
>                                'property it can't find
>                                'the table
>     .Open
>     If Not .EOF Then
>         Do While Not .EOF

>             empl = .Fields("empl")
>             punches = .Fields("punches")
>             ecnts = .Fields("ecnts")
>             pcnts = .Fields("pcnts")
>             tcnts = .Fields("tcnts")

>             'Some code goes here

>             .MoveNext
>         Loop

>         MsgBox "All Done", vbInformation, App.Title
>     Else
>         MsgBox "No records to show", vbCritical, App.Title
>     End If
>     .Close
> End With
> '==========================================================



Tue, 06 Sep 2005 11:12:05 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. open table dialog even though table is open?

2. How to open a table without opening the CDX

3. Error capturing when opening database connection

4. Opening Remote Views when No Net Connection Exists

5. to make a table, with all the filenames of a directory in it

6. bring directory filenames into a table

7. Create directories/files from fields in table.

8. Getting the names of files and directories into a table or array

9. copy table to other directory

10. Appending a table from a directory listing

11. DSNLess connection to Visual FoxPro table from Access 2000 using VB

12. list tables in ODBC Connection

 

 
Powered by phpBB® Forum Software