Solved

Help with DAO Data Grid

Posted on 2004-04-17
5
468 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 250 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Visual Basic Excel Formatting error 4 141
Adding to a VBA? 6 85
passing a value with stream reader AFTER a ";" 3 84
VB6 - Convert HH:MM into Decimal 8 70
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

726 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