Strange problem with a query

betsyr

Registered User.
Local time
Today, 12:01
Joined
Nov 1, 2001
Messages
17
I am opening a recordset using an SQL statement. The code is below. I am getting the error message: "Method 'Open' of object '_recordset' has failed." For some reason, the query is failing on one field. If I remove this field from the query, it works. If I susbstitute another field for this field, it works.
Why would an SQL query fail on one field? It is a normal text field with nothing different from other fields that I can determine.

Any help would be GREATLY appreciated.

Betsyr


Set rst = New Recordset
rst.ActiveConnection = CurrentProject.Connection
rst.CursorType = adOpenStatic
rst.LockType = adLockReadOnly

rst.Open Source:="SELECT [New Pieces Table].Title, [New Pieces Table].Medium, [New Pieces Table].Edition, [New Pieces Table].ArtistID, [New Pieces Table].Size FROM [New Pieces Table];", Options:=adCmdText

I am using Access 2002!
 
Instead of using this format to refer to your columns
[TableName].ColumnName
try using this one
[TableName].[ColumnName]

One of the names of your column might be recognized as a reserved word in Access.

anna
 

Users who are viewing this thread

Back
Top Bottom