Solved

Populate an UNBOUND DBGrid from a recordset

Posted on 2000-03-14
5
451 Views
Last Modified: 2013-12-25
I am using VB5 with SP3. I am trying to populate an UNBOUND DBGrid (5 columns) from a recordset. I do not want to use a bound DBGrid. I cannot understand the on-line help particularly the section on the RowBuffer.

Can someone set out the code in simple terms to populate the grid. It will usually be 5 or 6 rows.
0
Comment
Question by:PeterN
5 Comments
 
LVL 15

Expert Comment

by:ameba
ID: 2617895
This is many, many KB of code. The code is ugly and DBGrid control is also ugly.
0
 
LVL 15

Expert Comment

by:ameba
ID: 2617904
What is the record count of your recordset?
0
 

Expert Comment

by:amuru
ID: 2618316
i'm using VB6 currently.  I think to populate unbound data to grid display, it is easier if use MSFlxGrd/MSHFlxGrd control. Below is simple setting that might be useful for u, connected to access database.


Dim lPcode As String
lPcode = txtName.Text
dtaDetail.RecordSource = "Select RSLT_6COPY, RSLT_PCODE, RSLT_PNAME, RSLT_SUPCD, RSLT_DDATE, RSLT_IDATE from InspectResult where RSLT_PCODE = '" & lPcode & "'"
dtaDetail.Refresh

0
 
LVL 1

Accepted Solution

by:
tkuppinen earned 100 total points
ID: 2619832
Use the flex grid.  Much easier than the DBgrid.

then to add the records from a created recordset all you have to do is loop through

While Not rsNontrol.EOF
        msNontrol.AddItem (rsNontrol("Name") & vbTab & rsNontrol("Position") & vbTab & rsNontrol("SEX") & vbTab & _
        rsNontrol("Race") & vbTab & rsNontrol("education") & vbTab & rsNontrol("remarks"))
        msNontrol.RowData(msNontrol.Row) = CLng(rsNontrol("id"))
        rsNontrol.MoveNext
    Wend
0
 

Author Comment

by:PeterN
ID: 2625299
Was hoping to use the DBGrid but it seems that everyone agrees the MSFlexGrid is better. Thanks.
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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
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…

756 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