Use DbGrid in DAO ?

Posted on 1998-04-20
Last Modified: 2012-06-27
How to use DbGrid control without Data control:

Set Mydb = OpenDatabase("c:\db\Mydb.mdb")
Set Myset = Mydb.OpenRecordset("Table1", vbOpenTable)
DbGrid1.DataSource = ????
Question by:username1
  • 2

Accepted Solution

Dalin earned 50 total points
ID: 1425530
I believe that You need a data control to use the dbGrid.
The dataSource property is not available at run time. It has to be set at design time.

For your case, you use the datacontrol for just use the dbgrid. (still use the DAO for other purpose).

    Set Mydb = OpenDatabase("c:\db\Mydb.mdb")
    Set Myset = Mydb.OpenRecordset("Table1", vbOpenTable)
    Set data1.RecordSet = Myset

Hope it helped


Author Comment

ID: 1425531
Hi Dalin,

Thank you.

Do you mean I can not use any bound control without Data control?
The Data control is not avalable in VB5 trial versiion which is what I am using :-)

Expert Comment

ID: 1425532
Sorry...That is what Microsoft say...I wish I had better answer for you.

Expert Comment

ID: 1425533
Not true you do not need a data control with your grid. And Microsoft does not say this. You just have to take control off the grid update yourself. Read up on unbound grids in the online books for vb 5.0. Read up on UnboundAddData, UnboundDeleteRow,UnboundReadData, UnboundWriteData. This takes a lot more work of course than a bound grid. But it can be done and gives you a lot more control and performance.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now