Solved

Populate an UNBOUND DBGrid from a recordset

Posted on 2000-03-14
5
445 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
Comment Utility
This is many, many KB of code. The code is ugly and DBGrid control is also ugly.
0
 
LVL 15

Expert Comment

by:ameba
Comment Utility
What is the record count of your recordset?
0
 

Expert Comment

by:amuru
Comment Utility
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
Comment Utility
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
Comment Utility
Was hoping to use the DBGrid but it seems that everyone agrees the MSFlexGrid is better. Thanks.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…

763 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

15 Experts available now in Live!

Get 1:1 Help Now