Results 1 to 3 of 3

Thread: Grids

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2000
    Location
    UK
    Posts
    199

    Angry

    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.

  2. #2
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    736
    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]

  3. #3
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    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
  •  



Click Here to Expand Forum to Full Width