Microsoft DataGrid Control - interactive grid on a form

Huw Davies

New Member
Joined
Aug 26, 2005
Messages
20
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.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
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
 
Upvote 0
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,
 
Upvote 0
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.
 
Upvote 0
Huw

A Sasco type chart?:eek:

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.
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,213,497
Messages
6,113,998
Members
448,539
Latest member
alex78

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top