Solved

Use DbGrid in DAO ?

Posted on 1998-04-20
4
266 Views
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 = ????
0
Comment
Question by:username1
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
Dalin earned 50 total points
ID: 1425530
Username1.
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
    data1.Refresh

Hope it helped

Regards
Dalin
0
 

Author Comment

by:username1
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 :-)
0
 
LVL 9

Expert Comment

by:Dalin
ID: 1425532
UserName1,
Sorry...That is what Microsoft say...I wish I had better answer for you.
Regards
Dalin
0
 

Expert Comment

by:jhook010598
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.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

706 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

12 Experts available now in Live!

Get 1:1 Help Now