roh_8_it_3
Registered User.
- Local time
- Today, 00:30
- Joined
- Feb 15, 2005
- Messages
- 79
Hi All,
I have an adp project connected to sql server 2000.I need to bind a continous form to a dynamic sql query.For this I am trying to bind the form to a ADO recordset like me.recordset=rs.
Here is the code-
1).
Dim db As ADODB.Connection
Dim rs As New ADODB.Recordset
Dim sql As String
Sql=”select * from tablename”
Set db = rtnConnection
Set rs = db.Execute(sql)
Set Me.Recordset = rs
In rtnconnection,I m just opening a db connection with the connection string as
Public Const strConn = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=user;Pwd=pwd;Initial Catalog=mydb;Data Source=server"
It fails on Set Me.Recordset = rs,saying that-the object that you have entered is not a valid recordset property.
2.if I use Set db = currentproject.connection then it works fine.The connection string it uses is-
"Provider=Microsoft.Access.OLEDB.10.0;Persist Security Info=False;Data Source=server;User ID=user;Initial Catalog=mydb;Data Provider=SQLOLEDB.1"
Also if I change my global connection string to
'Public Const strConn = "Provider=Microsoft.Access.oledb.10.0;Data Provider=SQLOLEDB.1;Persist Security Info=False;User ID=user;Pwd=pwd;Initial Catalog=mydb;Data Source=server"
Then it works fine.
I did a google search and the following MS KB article says that this happens when you use a disconnected recordset to bind a form.
http://support.microsoft.com/kb/230737
but I don’t think I am using a disconnected recordset in snippet 1.
Any ideas/suggestions regarding this.Thanks
I have an adp project connected to sql server 2000.I need to bind a continous form to a dynamic sql query.For this I am trying to bind the form to a ADO recordset like me.recordset=rs.
Here is the code-
1).
Dim db As ADODB.Connection
Dim rs As New ADODB.Recordset
Dim sql As String
Sql=”select * from tablename”
Set db = rtnConnection
Set rs = db.Execute(sql)
Set Me.Recordset = rs
In rtnconnection,I m just opening a db connection with the connection string as
Public Const strConn = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=user;Pwd=pwd;Initial Catalog=mydb;Data Source=server"
It fails on Set Me.Recordset = rs,saying that-the object that you have entered is not a valid recordset property.
2.if I use Set db = currentproject.connection then it works fine.The connection string it uses is-
"Provider=Microsoft.Access.OLEDB.10.0;Persist Security Info=False;Data Source=server;User ID=user;Initial Catalog=mydb;Data Provider=SQLOLEDB.1"
Also if I change my global connection string to
'Public Const strConn = "Provider=Microsoft.Access.oledb.10.0;Data Provider=SQLOLEDB.1;Persist Security Info=False;User ID=user;Pwd=pwd;Initial Catalog=mydb;Data Source=server"
Then it works fine.
I did a google search and the following MS KB article says that this happens when you use a disconnected recordset to bind a form.
http://support.microsoft.com/kb/230737
but I don’t think I am using a disconnected recordset in snippet 1.
Any ideas/suggestions regarding this.Thanks