?
Solved

Help with DAO Data Grid

Posted on 2004-04-17
5
Medium Priority
?
471 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month13 days, 11 hours left to enroll

800 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