|
-
Aug 19th, 2008, 07:39 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Syntax error in FROM Clause
I have an Access 2003 database which has a link to table dbo_StandingSettelmentInstructionSearch
I am using ADO to access the data.
The below works fine.
Code:
SQLStr = "dbo_StandingSettlementInstructionSearch where ChangeState = 9"
Set TheConn = CurrentProject.Connection
Set TheRS = New ADODB.Recordset
TheRS.Open SQLStr, TheConn, adOpenKeyset, adLockPessimistic, adCmdTable
However when I change the SQLStr string to
Code:
"select oid, Country from dbo_StandingSettlementInstructionSearch where ChangeState = 9"
I get an error message saying
Run-Time Error '-2147217900 (80040e14)'
Syntax Error in the FROM Clause.
Can anyone offer any insight as to why this might be.
Please notem in case it might be to do with the table name length, I have
created a Query to reduce the table name but still got the same error.
Signature Under Construction 
-
Aug 19th, 2008, 08:20 AM
#2
Re: Syntax error in FROM Clause
Try changing the underscore (dbo_) to a period (dbo.)
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Aug 19th, 2008, 08:40 AM
#3
Re: Syntax error in FROM Clause
did you change the command type?
Code:
TheRS.Open SQLStr, TheConn, adOpenKeyset, adLockPessimistic, adCmdTable
When you changed it to a select, it no longer becomes a table... but text..
Code:
TheRS.Open SQLStr, TheConn, adOpenKeyset, adLockPessimistic, adCmdText
-tg
-
Aug 19th, 2008, 11:53 AM
#4
Thread Starter
Hyperactive Member
Re: Syntax error in FROM Clause
Hi Gary,
The Underscore is actually a part of the Table Name
Hi techgnome,
I changed the command type to adCmdText and it worked.
Many Thanks.
Signature Under Construction 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|