I'm hoping someone can explain this to me. I'm retreiving data from an Access 97 database using an ADO data control in VB6. In this database, I have a table called "position" from which I'd like to get some records. The query I really want to run is:
SELECT position_number, group_number, title, type
FROM position LEFT JOIN groupnumbers
ON position.group_ID = groupnumbers.group_ID
I know there's nothing inherently wrong with the SQL, because I can copy and paste it into Access and the query runs as expected. However, when I do the Datacontrol.Refresh in my code, I get a message box with an OK button and no title reading:
[ADODC]: Unknown error. [ADO]:
When I push the button, this is immediately followed by the VB error:
Run-time error '-2147467259 (80004005)'
Method 'Refresh' of object IAdodc' failed
Now, the wierd thing is that if I use just the simple query
SELECT * FROM position
I get the same error. However, if I just change it to
SELECT * FROM [position]
then it works. It also works if I simply rename the table from "position" to "position1."
So the name "position" is obviously causing the problem. But why? I know "position" isn't a reserved word in SQL, so that can't be it. That just leaves ADO. Is there some arcane operation done on the string before passing it to the database which could use "position" as a reserved word? Where is this problem coming from?
SELECT position_number, group_number, title, type
FROM position LEFT JOIN groupnumbers
ON position.group_ID = groupnumbers.group_ID
I know there's nothing inherently wrong with the SQL, because I can copy and paste it into Access and the query runs as expected. However, when I do the Datacontrol.Refresh in my code, I get a message box with an OK button and no title reading:
[ADODC]: Unknown error. [ADO]:
When I push the button, this is immediately followed by the VB error:
Run-time error '-2147467259 (80004005)'
Method 'Refresh' of object IAdodc' failed
Now, the wierd thing is that if I use just the simple query
SELECT * FROM position
I get the same error. However, if I just change it to
SELECT * FROM [position]
then it works. It also works if I simply rename the table from "position" to "position1."
So the name "position" is obviously causing the problem. But why? I know "position" isn't a reserved word in SQL, so that can't be it. That just leaves ADO. Is there some arcane operation done on the string before passing it to the database which could use "position" as a reserved word? Where is this problem coming from?