Dear morse2,
First of All, you have to include the two classes required to implement DataBase functions: "afxdao.h" and "afxdisp.h".
Then you have to declare a variable of the type "CDaoDatabase", which you will use to open the database the following way:
CDaoDatabase db;
db.Open(path of the database);
The next step is declaring a string variable where you will store your query:
char StrSQL[200];
strcpy(StrSQL,"Select......"

;
if your query is an "Insert Into", a "Delete", or an "Update", just execute it like this:
db.Execute(StrSQL);
However, if it is a "Select", you have to declare a variable of the type CDaoRecordset. The result of your query will be stored in this variable.
then declare a variable of the type COleVariant:
CDaoRecordset rs;
COleVariant Ret;
.
.
.
rs.Open(dbOpenDynaset,_T(StrSQL));
rs.GetFieldValue(name of the field between quotation,ret1);
COleVariant is a struct that contains several fields, but only one of them will have the right value. It depends on the type of the field in the database. When you find out what it is, use a cast before it.
I hope I've been helpful.