Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set Data Control to Recordset

Status
Not open for further replies.

colobill

Programmer
Dec 16, 2003
22
US
I have a situation where programmatially I have established a recordset object (Dim ADORs As New ADODB.Recordset). I am using true db grid which depends on a data control. I want to set the recordset of the data control to the recordset of ADORS. For example:

data1.recordset = ADORS.recordset

But VB 6 does not like that. Any suggestions?
 
that does not quite work because adors does not have the recordset property. Any other ideas?

set Adodc1.Recordset = adors.?
 
Sorry ... if only I could read ...
Code:
   Set data1.recordset = ADORS
I'm assuming that you have populated ADORS somewhere prior to this assignment.
 
I did set it to:

Set Adodc1.Recordset = ADORs

and i ran a query but nothing shows up in the grid, which is set to the data control Adoc1.
 
Did you mean:
Set Adodc1.Recordsource = ADORs

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 

>Set Adodc1.Recordset = ADORs

This is the correct syntax.

But, depending on the DMBS you are using, could it be that that DBMS doesn't support (automatically) the IRowsetIdentity property with a server side cursor, such as with a JET MDB?

If not, then you will need to code it to do so, setting this property prior to opening the recordset, or use a client side cursor (ADORs.CursorLocation = adUseClient)
 
it is still not working for me. let me summarize and provide some code. I have true db grid which is associated with a data control (Adodc1). When the recordset of Adodc1 changes, the grid redisplays new data. I am trying to set Adoc1.recordset to ADORs and some property so that the Adoc1.recordset changes (after the query) and the grid display changes. Any help would be appreciated.

Dim sql As String
Dim ADOConn As New ADODB.Connection
Dim ADORs As New ADODB.Recordset

ADOConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & App.Path & "\ELPALS.mdb"

sql = "SELECT * FROM SLPT WHERE AGELEVEL = '" & w_agelevel & "' AND " _
& "THEME = '" & w_theme & "' AND " _
& "ACTIVITYTYPE = '" & w_activity & "' AND " _
& "LESSONGROUP = '" & w_lessongroup & "'"

Set Adodc1.Recordset = ADORs
 
I had a similar problem awhile ago... I ended up refreshing the grid after the query and that fixed it
 
Well, you haven't opened ADORs yet. Where is the open code for this?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top