Thanks Thanks:  0
Likes Likes:  0
Results 1 to 7 of 7

Thread: Microsoft DataGrid Control - interactive grid on a form

  1. #1
    New Member
    Join Date
    Aug 2005
    Posts
    20
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Microsoft DataGrid Control - interactive grid on a form

    Can anyone give me simple instructions on how to put a grid control on an Access form and link it interactively with a query in the database. A small working example would be wonderful.

  2. #2
    Board Regular
    Join Date
    Apr 2003
    Location
    Jacksonville, FL
    Posts
    1,344
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Disclaimer: I may not have an opportunity to comment again for a couple days.

    Question - What version of Access & VB are you using? If I'm not mistaken, Datagrids are a .Net control. Are you linking to an external non-access database?

    Now, if you're talking about a Dataview - just a display view for a query, try opening up a new form and selecting a table or query to bind to it and then select dataview as the default way it displays the results inside the form.

    If you start peeking around at the form properties in design mode, you'll find some entries in the Recordsource or Rowsource properties that relate to the choices you made using the wizard interface.

    Mike

  3. #3
    Board Regular VicRauch's Avatar
    Join Date
    Mar 2006
    Location
    Sacramento, CA
    Posts
    2,032
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Within design view of a form, you have the choice of Single Record, Multiple Records, or DataSheet view. The DataSheet sounds like what you are asking for.

    Create a form with the fields you want on it, set the Default View (Format tab, properties dialog) to Datasheet, then when you open the form, you will see the "grid" I think you are looking for.
    HTH,
    Vic

  4. #4
    New Member
    Join Date
    Aug 2005
    Posts
    20
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I'm using Access 2003 under XP prof. The control that I'm looking at is an ocx control called "VideoSoft FlexArray Control" that came with Access. It paints a very nice configurable grid control on a form but I can't find any way to link it to data. Alternatively I found an Excel type grid called Microsoft Office Spreadsheet 11.0 and I can't find any way to link that to data either. I don't really want to simulate a grid using a data sheet. I'm actually trying to work towards an interactive Sasco type chart.

  5. #5
    Board Regular Norie's Avatar
    Join Date
    Apr 2004
    Location
    Stirling
    Posts
    72,576
    Post Thanks / Like
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)

    Default

    Huw

    A Sasco type chart?:o

    Sorry, I don't actually know what that is.

    I'll perhaps have a wee look on the web to find out what that is.

    In the meantime I would recommend that you have a rethink about using non-standard controls.

    If you are developing this across multiple users/platforms/versions then you might find yourself running in to problems.
    If posting code please use code tags.

  6. #6
    MrExcel MVP
    Moderator
    SydneyGeek's Avatar
    Join Date
    Aug 2003
    Location
    Sydney, Australia
    Posts
    12,255
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)

    Default

    As Vic mentioned, use a subform and display it in Datasheet mode -- that is the simplest way to show one-to-many datasets in Access.

    If you really need a flexgrid, here is a link that may help. To be honest, there's not a lot of useful info out there for Access and Flexgrids -- they are really intended more for VB and VB.Net projects.

    Hope this helps

    Denis
    Self-preservation: For when you've got yourself in a jam
    ------------------------------------------------------
    My site contains a number of Excel and Access Resources

  7. #7
    Board Regular
    Join Date
    Apr 2003
    Location
    Jacksonville, FL
    Posts
    1,344
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I have no idea if this will help you. I've never used that particular object within Access, however, I have done a limited amount of work with datagrids in .Net.

    Datagrids in .Net work in a fashion that really is completely different from recordsets and ADODB type connections. This is a snippet from some code I wrote, however, it's pretty generic so I included it here. Again, to emphasize, this is not VB6.0.



    Code:
                adapter = New OleDb.OleDbDataAdapter(sqlStatement, connection)
                accessData = New DataTable("theData")
    
                Dim ds As DataSet
                ds = New DataSet("theData")
                ds.Tables.Add(accessData)
                dgResults.DataSource = ds
                adapter.Fill(accessData)
    
                'Clear any bindings from the DataGrid and set the DataSource of the DataGrid 
                'to the new excelData DataTable 
                dgResults.DataBindings.Clear()
                dgResults.DataSource = accessData
    Working with individual records and/or fields requires you to work wish DataColumn & DataRow objects.

    I'm thinking you'll do better to work with something else, however.

    Mike

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


DMCA.com