Cannot use a select statement with Access

Results 1 to 2 of 2

Thread: Cannot use a select statement with Access

  1. #1
    Join Date
    Dec 1969

    Default Cannot use a select statement with Access

    Hi all,<BR><BR>I am having problems opening a recordset. If I open a rs with just a table name it works fine. For example objRec.Open "table1", objConn, ...<BR><BR>However once I switch it to a SQL string I get the following error message:<BR><BR>Microsoft JET Database Engine error &#039;80040e14&#039; <BR><BR>Syntax error in FROM clause. <BR><BR>/forums/forumlisting.asp, line 19 <BR><BR>My string to open the rs looks like this<BR><BR>objRec.Open "select c1, c2 from table1", objconn, ...<BR><BR>I have tested in access and this is a totally valid SQL string there is nothing wrong at all with the syntax. I looked for that error message on Microsoft&#039;s knowledge base but couldn&#039;t find anything. This is an extremely simple select statement and I can&#039;t for the life of me figure out what the problem is. I even tried using a different database in case the first one was corrupted but got the same results. I can open the rs if I just specify a table name but if I try and use a SQL statement it gives me the error mentioned above. Any info is appreciated.<BR><BR>Justin

  2. #2
    Join Date
    Dec 1969

    Default RE: Cannot use a select statement with Access

    What are the rest of the arguments to the open method? Do you have adCmdText or adCmdTable? If you have a select statement it should be the former.

Posting Permissions

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