|
-
Aug 3rd, 2006, 05:07 AM
#1
Thread Starter
Fanatic Member
Open of object recordset failed
Hi
When I execute this query:
rs6.Open SQL, cn, adOpenKeyset, adLockPessimistic
the following message occurs:
"Open of object recordset Failed"
I am using Access database
What's wrong?
Thanks
-
Aug 3rd, 2006, 05:08 AM
#2
Hyperactive Member
Re: Open of object recordset failed
how u have declared the rs6 ?
-
Aug 3rd, 2006, 05:22 AM
#3
Re: Open of object recordset failed
Most probably you are using a reserved keyword in your query, like DATE, NAME, etc. Try to wrap the Column names in Square Brackets.
If that doesn't help then please show us what is in SQL variable?
Use [code] source code here[/code] tags when you post source code.
My Articles
-
Aug 3rd, 2006, 05:35 AM
#4
Re: Open of object recordset failed
Show the code surounding that statement...
-
Aug 3rd, 2006, 05:35 AM
#5
Thread Starter
Fanatic Member
Re: Open of object recordset failed
The SQl expression is
VB Code:
SQL = "Select * from test inner Join Client on test.ClientID=Client.ClientID"
SQL = SQL & " inner Join Contact on test.ContactID=Contact.ContactID"
SQL = SQL & " inner Join Event on test.EventID=Event.EventID"
SQL = SQL & " inner Join Interval on test.IntID=Interval.IntID"
SQL = SQL & " inner Join Satellite on test.SatelliteID=Satellite.SatelliteID"
SQL = SQL & " inner Join Origin on test.OriginID=Origin.OriginID"
SQL = SQL & " inner Join Destination on test.DestinationID=Destination.DestinationID"
SQL = SQL & " inner Join Guest on test.GuestID=Guest.GuestID where BID=12"
Please help me
-
Aug 3rd, 2006, 05:41 AM
#6
Re: Open of object recordset failed
You need to show more that just the SQL statement. More code...
What is rs6 defined as? Did you open the database? etc...
We cannot see anything from one or two statements...
-
Aug 3rd, 2006, 05:46 AM
#7
Thread Starter
Fanatic Member
Re: Open of object recordset failed
Well I used Rs6 to open another SQl and it worked,so i am pretty sure that the error is from the SQL string
What's wrong in my SQL string?
thanks
-
Aug 3rd, 2006, 05:48 AM
#8
Re: Open of object recordset failed
If you are go tell us what is wrong, then why ask the question...
Did you test the SQL statement in native Access?
Last edited by randem; Aug 3rd, 2006 at 05:56 AM.
-
Aug 3rd, 2006, 05:52 AM
#9
Re: Open of object recordset failed
 Originally Posted by engnouna
The SQl expression is
VB Code:
SQL = "Select * from test inner Join Client on test.ClientID=Client.ClientID"
SQL = SQL & " inner Join Contact on test.ContactID=Contact.ContactID"
SQL = SQL & " inner Join Event on test.EventID=Event.EventID"
SQL = SQL & " inner Join Interval on test.IntID=Interval.IntID"
SQL = SQL & " inner Join Satellite on test.SatelliteID=Satellite.SatelliteID"
SQL = SQL & " inner Join Origin on test.OriginID=Origin.OriginID"
SQL = SQL & " inner Join Destination on test.DestinationID=Destination.DestinationID"
SQL = SQL & " inner Join Guest on test.GuestID=Guest.GuestID where BID=12"
Please help me
Try wrapping up your columns/Table names in square brackets [] in your SQL and the problem will be resolved. I guess it is Event/Test /Interval that is creating this problem.
Use [code] source code here[/code] tags when you post source code.
My Articles
-
Aug 3rd, 2006, 06:54 AM
#10
Thread Starter
Fanatic Member
Re: Open of object recordset failed
Well i tried this
VB Code:
SQL = "Select * from [test]"
SQL = SQL & " inner Join [Client] on [test].[ClientID]=[Client].[ClientID]"
SQL = SQL & " inner Join [Contact] on [test].[ContactID]=[Contact].[ContactID]"
SQL = SQL & " inner Join [Event] on [test].[EventID]=[Event].[EventID]"
SQL = SQL & " inner Join [Interval] on [test].[IntID]=[Interval].[IntID]"
SQL = SQL & " inner Join [Satellite] on [test].[SatelliteID]=[Satellite].[SatelliteID]"
SQL = SQL & " inner Join [Origin] on [test].[OriginID]=[Origin].[OriginID]"
SQL = SQL & " inner Join [Destination] on [test].[DestinationID]=[Destination].[DestinationID]"
SQL = SQL & " inner Join [Guest] on [test].[GuestID]=[Guest].[GuestID] where [test].[BID]=12"
But it returned "Syntax error missing operator"
I am desperate,what's wrong with my SQL statement?
Thanks
-
Aug 3rd, 2006, 07:47 AM
#11
Re: Open of object recordset failed
Shouldn't it be
VB Code:
SQL = "Select [TEST].* from [test]"
And is BID a numeric field?
Use [code] source code here[/code] tags when you post source code.
My Articles
-
Aug 3rd, 2006, 08:41 AM
#12
Re: Open of object recordset failed
 Originally Posted by Shuja Ali
I guess it is Event/Test /Interval that is creating this problem.
I would agree that those names are dubious, and should be enclosed.
I'm not sure about the others (Contact/Origin/..), so it's safest to do them anyway.
 Originally Posted by Randem
Did you test the SQL statement in native Access?
I would assume not, as Access tends to not like joins without its own special format of brackets, which are something like this:
Code:
FROM ((t1
INNER JOIN t2 ON ...)
INNER JOIN t3 ON ... )
INNER JOIN t4 ON ...
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
|