|
-
Nov 16th, 2000, 05:27 PM
#1
Thread Starter
Addicted Member
HELP HELP HELP HELP HELP HELP HELP HELP
I am using the dataenvironment in VB6. I wish to change the recordset dynamically while the grid is displayed. I am failing to be able to do this. I have tried to use the datagrid control for adodc and have also tried to use the flexgrid but with little knowledge of this, gained no success.
Thankyou all in advance.
Bewildered
Paul.
-
Nov 16th, 2000, 06:44 PM
#2
Fanatic Member
Paul,
I don't have a good example with me, but I believe you will just need to set the datasource and datamember through code.
Code:
Private Sub Command1_Click()
Set Datagrid1.DataSource=name of your dataenvironment
Datagrid1.DataMember="name of the recordset"
End Sub
The DataEnvironment name will not have double-quotes around it. The DataMember name will need double-quotes.
[Edited by jbart on 11-16-2000 at 06:52 PM]
-
Nov 16th, 2000, 07:40 PM
#3
PowerPoster
Simple connection to Access 2000 MDB
Code:
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
'Open the connection
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _
"Data Source=" & UserDataBase
'Open recordset
rst.Open "SELECT * FROM Access_Headers", _
cnn, adOpenKeyset, adLockOptimistic
add records to grid thru loop
[code]
Dim mydata As String
for x=1to rst.recordcount
mydata _
= rst!Field1 _
& vbTab & rst!Field2 _
& vbTab & Field3
msflexgrid1.AddItem mydata
next x
This is the basic idea
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
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
|