?
Solved

Create field from openCDaoRecorset table

Posted on 1999-01-18
5
Medium Priority
?
239 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 400 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

Technology Partners: 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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

800 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