Hi, I am kind of new to Visual C++, and I am sure this is probably a really obvious question because people have to do this all the time but I am in a time crunch so I am asking for any help possible.
What I have is a Microsoft Access Database with three tables: Users, Contacts, and Appointments. The program works by having the user log in and then the appointments and contacts for this user are displayed. I did this be using the MFC wizzard and doing a single document with-out file support, for DB and then linked it to my ODBC entry and selected for all three tables to be brought in. Because I selected all 3 tables to be brought in I cannot edit my data, and this causes a problem.
Now from putzing around I have learned that the Wizard creates like 5 classes in order to get the data, and display the data. Each of the classes has what it calls a base class. The class that is responsible for bringing in the data is called ODBCTrialOneSet, and its base class is CRecordset.
Then the class that drives what we see in the main form as far as any functions for buttons and displaying the data is called ODBCTrialOneView, and its base class is CRecordView.
Now there are two other classes: MainFrame and ODBCTrialOneDoc. I don't really understand what these two classes do, other than that they are responsible for helping display the window...
So anyway what I am trying to do is make it so my program is capable of updating the data also. And through trial and error I decided probably the best way to do this would be to create another screen, either a dialog box or form, that would have its own recordset specific to the table I want to edit. Now when you create a dialog box
and then you go to create a class for the dialog box it defaults to the base class of CDialog... and in order for me to get my data to show up I have to change it to the base class of CRecordView, which is fine. And then the recordview needs to be linked to another class I create with the base class CRecordSet - the one where I actually load in the table. And this is all fine and dandy no problems here, I can do all this. But what I can't do for the life of me is to get that dialog box to show up. Because I can't type in this for example
(CEditUsersView is class name):
//
CEditUsersView dlg;
dlg.DoModal();
//
I can't do this because CEditUsers base class is not CDialog, its CRecordView, and as far as I can tell you can't asign those to a variable and then call them like that... it won't let me. And I did add refernces to the header files where they needed to be, so that
isn't the issue... So how do I get the dialog box to appear? If I was to make a dialog box with the base class CDialog is there anyway I can get at the recordset in my CEditUsersView? (called m_pSet) **Note
m_pSet populates itself from the CEditUsersSet class which has the base class CRecordSet.
This maybe the totally wrong way to go about it... so I don't know,
any suggestions?
Thanks in advance!!!
Eric
What I have is a Microsoft Access Database with three tables: Users, Contacts, and Appointments. The program works by having the user log in and then the appointments and contacts for this user are displayed. I did this be using the MFC wizzard and doing a single document with-out file support, for DB and then linked it to my ODBC entry and selected for all three tables to be brought in. Because I selected all 3 tables to be brought in I cannot edit my data, and this causes a problem.
Now from putzing around I have learned that the Wizard creates like 5 classes in order to get the data, and display the data. Each of the classes has what it calls a base class. The class that is responsible for bringing in the data is called ODBCTrialOneSet, and its base class is CRecordset.
Then the class that drives what we see in the main form as far as any functions for buttons and displaying the data is called ODBCTrialOneView, and its base class is CRecordView.
Now there are two other classes: MainFrame and ODBCTrialOneDoc. I don't really understand what these two classes do, other than that they are responsible for helping display the window...
So anyway what I am trying to do is make it so my program is capable of updating the data also. And through trial and error I decided probably the best way to do this would be to create another screen, either a dialog box or form, that would have its own recordset specific to the table I want to edit. Now when you create a dialog box
and then you go to create a class for the dialog box it defaults to the base class of CDialog... and in order for me to get my data to show up I have to change it to the base class of CRecordView, which is fine. And then the recordview needs to be linked to another class I create with the base class CRecordSet - the one where I actually load in the table. And this is all fine and dandy no problems here, I can do all this. But what I can't do for the life of me is to get that dialog box to show up. Because I can't type in this for example
(CEditUsersView is class name):
//
CEditUsersView dlg;
dlg.DoModal();
//
I can't do this because CEditUsers base class is not CDialog, its CRecordView, and as far as I can tell you can't asign those to a variable and then call them like that... it won't let me. And I did add refernces to the header files where they needed to be, so that
isn't the issue... So how do I get the dialog box to appear? If I was to make a dialog box with the base class CDialog is there anyway I can get at the recordset in my CEditUsersView? (called m_pSet) **Note
m_pSet populates itself from the CEditUsersSet class which has the base class CRecordSet.
This maybe the totally wrong way to go about it... so I don't know,
any suggestions?
Thanks in advance!!!
Eric