Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Help with DAO Data Grid

Posted on 2004-04-17
5
Medium Priority
?
473 Views
Last Modified: 2013-12-25
I have an older VB6 program that uses the DAO Data Grid (DBGrid1).  The data source is Data1. The dbgrid96.hlp help file, by the way, is missing.
My question is, how can I change the width of one of the columns? If I do it using the DBGrid1 property pages, the width of the column does change, but the records appear empty.
Can I do it through the program?
Can you tell me where to get the dbgrid96.hlp file?
Thank you.

Eduardo
0
Comment
Question by:EduardoBerger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 1000 total points
ID: 10852368
You can change the width with the mouse at run time, or you can do it programatically.

Private Sub Command1_Click()
Dim c As Variant
'walk through the collection
For Each c In DBGrid1.Columns
    c.Width = c.Width * 1.5
Next c
'or one at a time
DBGrid1.Columns(2).Width = 1000
End Sub

I don't have the help file. I have an old version of the MSDN instead.

0
 

Author Comment

by:EduardoBerger
ID: 10856169
Hi Graham,
Thank you for your answer. It worked fine and the points are yours (please tell me if I need to do something about it).

Is there a way for you to send me the info contained in the file dbgrid96.hlp, or a document that will help me program the DBGrid1? Or a way to get your older version of MSDN (it was not available in the link you gave me).

And one last question on the same topic, if I may. Can I assign a field of a table or query to a specific column of the grid? And can the grid find out what the width of that field is? Thank you.

Eduardo
<email removed Bingie - EE PE>
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 10858011
The EE moderators usually remove any exchange of eMail addresses, but I think if you re-install Visual Studio it should install the help file.

You can select which fields are displayed in which column with the property pages, there doesn't appear to be any way of programatically, either doing that or finding out what was done.  Therefore would recommend changing the order in the recordset query. That way you can find the field width by referring to the column number:

Private Sub Command1_Click()
    Dim c As Integer
   
    For c = 0 To DBGrid1.Columns.Count - 1
        Debug.Print Data1.Recordset.Fields(c).Size
    Next c
End Sub

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Suggested Courses

618 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