Click here to Skip to main content
12,950,090 members (64,726 online)
Click here to Skip to main content
Add your own
alternative version


23 bookmarked
Posted 14 Oct 2002

How to use CodeProject Grid in MS Access to view multiple intermediate results

, 14 Oct 2002
Rate this:
Please Sign up or sign in to vote.
This article is about using MFC CodeProject Grid, ATL and MS Access together.

Sample Image - CPGridDlg.gif


This article is about using MFC CodeProject Grid, ATL and MS Access together. The frequently appeared task while using MS Access is showing some intermediate data, after processing another data. For example - showing multiple errors (minus check) after rollback transaction of multistring documents. In Access, we need to create a temporary table and form template for all these cases. There are several ways to avoid this drawback. I've designed a COM control, based on ATL, CodeProject Grid and MFC CDialog class. It supports methods: AddStr, ColumnWidths, Show, Hide and Clear.

How to cook this control:

  1. Create a new ATL object by Wizard (don't forget include support of MFC);
  2. Add new Simple control;
  3. Add new Form (with CDialog class) by Wizard;
  4. Insert CodeProject Grid files into project;
  5. Add Grid variable dialog class, write all necessary initializations of grid;
  6. Add COM methods and corresponding methods to dialog class;

Example of using CPGridView in MS Access:

Option Compare Database
Option Explicit
Dim d As CPGridDlg
Function f()
Set d = New CPGridDlg
d.addStr "qwert", 1, 0
d.addStr "12345" & Chr(9) & "67890", 0, 0

d.addStr "qwert", 18, 0
d.addStr "12345" & Chr(9) & "67890" & Chr(9) & "Some string", 0, 0

Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset("SELECT TOP " + _ 
    "10000 * FROM stocks_opt_rpt_buf02") 
'Hemi stress testing
'It takes only 5 seconds to fill 10 000 records into grid - good grid!
d.ColumnWidths "60" & Chr(9) & "60" & Chr(9) & "200" & Chr(9) & "200"
Do While Not rs.EOF
d.addStr rs!Item & Chr(9) & rs!item & Chr(9) _ 
  & rs!qty & Chr(9) & rs!TotalSales, 0, 0

End Function


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
Russian Federation Russian Federation
No Biography provided

You may also be interested in...


Comments and Discussions

GeneralCould not compile; files missing. Pin
WREY22-Oct-02 1:12
memberWREY22-Oct-02 1:12 
GeneralRe: Could not compile; files missing. Pin
rkdev22-Oct-02 2:40
memberrkdev22-Oct-02 2:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170525.1 | Last Updated 15 Oct 2002
Article Copyright 2002 by rkdev
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid