Results 1 to 2 of 2

Thread: Problem opening a recordset ***RESOLVED (somewhat) ***

  1. #1
    DerFarm
    Guest

    Problem opening a recordset ***RESOLVED (somewhat) ***

    [code]

    Dim CategoricalRST As New ADOdb.Recordset
    Dim SQL As String

    strTemp0 = List2Add
    intTemp0 = 1

    SQL = "SELECT [" & CategoricalTBLName & "].* "
    SQL = SQL & " FROM [" & CategoricalTBLName & "];"

    CategoricalRST.Open SQL, CN, , , adCmdTable
    [code]


    CN is an open connection, properly passed. I can retrieve the connection string. SQL comes out as "Select [Name].* FROM [Name];" and it works in an Access query.

    I get RunTime error (some huge negative number)
    with the explanation: "Syntax error in FROM Clause"

    I get the same error when replacing sql with the categoricaltblname.



    Any suggestions?

    I get

  2. #2
    DerFarm
    Guest
    ok, this works, but don't ask me why

    Code:
       SQL = "SELECT [" & CategoricalTBLName & "].* "
       SQL = SQL & " FROM [" & CategoricalTBLName & "];"
       
       Set CategoricalRST = New ADODB.Recordset
       CategoricalRST.CursorType = adOpenKeyset
       CategoricalRST.LockType = adLockOptimistic
       CategoricalRST.ActiveConnection = CN
       CategoricalRST.Open SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width