Click here to Skip to main content
15,896,912 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
General*** Retriving Rows of Data from Access Tables ** Pin
Steve Lai28-Aug-00 15:40
Steve Lai28-Aug-00 15:40 
GeneralRe: *** Retriving Rows of Data from Access Tables ** Pin
lauren28-Aug-00 21:07
lauren28-Aug-00 21:07 
GeneralRe: *** Retriving Rows of Data from Access Tables ** Pin
Steve Lai29-Aug-00 10:39
Steve Lai29-Aug-00 10:39 
GeneralRe: *** Retriving Rows of Data from Access Tables ** Pin
lauren30-Aug-00 3:09
lauren30-Aug-00 3:09 
GeneralRe: *** Retriving Rows of Data from Access Tables ** Pin
Steve Driessens28-Aug-00 22:28
Steve Driessens28-Aug-00 22:28 
GeneralRe: *** Retriving Rows of Data from Access Tables ** Pin
Steve Driessens28-Aug-00 22:49
Steve Driessens28-Aug-00 22:49 
GeneralRe: *** Retriving Rows of Data from Access Tables ** Pin
Steve Lai29-Aug-00 10:41
Steve Lai29-Aug-00 10:41 
GeneralRe: *** Retriving Rows of Data from Access Tables ** Pin
Steve Driessens29-Aug-00 15:02
Steve Driessens29-Aug-00 15:02 
G'day Steve,

Have a look at the CDaoRecordset class in the VC++ docs.

Something like the following should work. (I haven't tried this as I use Class Wizard generated recordsets, but I think is hould work OK).

CDaoDatabase db;
db.Open("AccessFileName.mdb", ...);

CDaoTableDef td;
td.Open("MyTable");

CDaoRecordset set(&db);
set.Open(&td);

// To fetch the total number of records in the table...
int nNumRecords = set.GetRecordCount();

// Step to the 5th record...
// NOTE: This moves 5 records forward from the current record.
set.Move(5); 

// Fetch the contents of the 'Name' field. 
COleVariant var;
set.GetFieldValue(_T("Name"), var);

// Move to the 8th record.  We're currently positioned on 
// the 5th record, so we need to move forward 3 rows.
set.Move(3); 

// Fetch the contents of the 'Name' field. 
set.GetFieldValue(_T("Name"), var);

set.Close();
td.Close();
db.Close();


Hope this makes sense.

Steve
GeneralRe: *** Having Trouble! ** Pin
Steve Lai30-Aug-00 12:04
Steve Lai30-Aug-00 12:04 
Questiondll assumptions? Pin
trey28-Aug-00 11:16
trey28-Aug-00 11:16 
AnswerRe: dll assumptions? Pin
Michael Dunn28-Aug-00 13:55
sitebuilderMichael Dunn28-Aug-00 13:55 
GeneralTab Control Pin
sunny28-Aug-00 6:57
sunny28-Aug-00 6:57 
GeneralFunction pointer in C++ Pin
bah28-Aug-00 5:04
bah28-Aug-00 5:04 
GeneralRe: Function pointer in C++ Pin
myself28-Aug-00 6:29
myself28-Aug-00 6:29 
GeneralRe: Function pointer in C++ Pin
Michael Dunn28-Aug-00 7:58
sitebuilderMichael Dunn28-Aug-00 7:58 
GeneralFile Comparing Pin
Shibu.m.b27-Aug-00 3:11
sussShibu.m.b27-Aug-00 3:11 
GeneralFile Comparing Pin
Shibu.m.b27-Aug-00 3:07
sussShibu.m.b27-Aug-00 3:07 
GeneralImage Comparison Pin
Shaji.S.Nair27-Aug-00 2:48
sussShaji.S.Nair27-Aug-00 2:48 
QuestionLaunch program when window starts? Pin
Eq26-Aug-00 22:11
Eq26-Aug-00 22:11 
AnswerRe: Launch program when window starts? Pin
HP28-Aug-00 20:00
HP28-Aug-00 20:00 
QuestionLaunch program when window starts? Pin
Eq26-Aug-00 22:11
Eq26-Aug-00 22:11 
AnswerRe: Launch program when window starts? Pin
trey27-Aug-00 6:30
trey27-Aug-00 6:30 
GeneralSeemingly unbelievable menu problem Pin
David Bates30-Aug-00 12:35
David Bates30-Aug-00 12:35 
GeneralEdit Box Problem!! Pin
sunny30-Aug-00 11:35
sunny30-Aug-00 11:35 
GeneralRe: Edit Box Problem!! Pin
Erik Funkenbusch30-Aug-00 13:48
Erik Funkenbusch30-Aug-00 13:48 

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.