Solved

Create field from openCDaoRecorset table

Posted on 1999-01-18
5
238 Views
Last Modified: 2010-05-18
How do I create a field in an existing table from a CDaoRecordset that is already open via CDaoRecordset::Open( ) ?  My my class name is m_csetExams deriverd from CDaoRecordset
0
Comment
Question by:Surfer
[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 1

Expert Comment

by:Seeker092397
ID: 1184483
You cann't create new field in the table using CDaoRecordset. You have to open the table using CDaoTableDef and call its CreateField function.
0
 

Author Comment

by:Surfer
ID: 1184484
How do I create a field in an already created table using CDaoTableDef?  I have only seen exaples on using CDaoTableDef to create the table and then adding tables.  I get an error msg telling me the table is already open if a trie to open it.  This makes sence because the recordset is open to grat the table info.  Do I close the recordset and reopen it using CDaoTableDef?  This  seems like I am doing to much work.
0
 

Author Comment

by:Surfer
ID: 1184485
Adjusted points to 200
0
 
LVL 1

Expert Comment

by:The_Brain
ID: 1184486
You cant open on an open database, if you wan't to restart it just call
depending on (.) no pointer, (->) pointer to member
mcSetExams(./->)Requery()

(I think that might do it.)

I will try to do it.  Could you tell me exactly what you are starting with and what you want to do. and what you will end with?

then I can try to help.

0
 
LVL 4

Accepted Solution

by:
pellep earned 200 total points
ID: 1184487
First you must call Close() in your CDaoRecordset. Then open a CDaoTableDef, call CreateField() and then call Append() to add the field to the fields collection. Now, close the tabledef and reopen your CDaoRecordset using the Open() command (with appropriate variables).
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

707 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