Solved

Populate an UNBOUND DBGrid from a recordset

Posted on 2000-03-14
5
453 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
[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
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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

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…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…

729 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