Failed to create empty document

How to troubleshoot if I encountered a message box with the following:

Failed to create empty document

Application using Single Document Interface;
Data Access Technology using ODBC; and
Database using Microsoft Access97

Seeking for solution or troubleshooting options.  Thanking in advance.

The followers of Christ
December 18, 1999 - Saturday (15:00GMT)
Who is Participating?
mikeblasConnect With a Mentor Commented:
This error means that MFC tried to create a new instance of some CDocument-derived class and the creation failed. The constrcutor probably threw an exception.

Or, the view associated with this document didn't successfully create itself. It's constructor may have thrown an exception, or it simply failed to create the windows it wanted to create.

If you're using ODBC, then your code might have failed while creating or opening your CDatabase or CRecordset objects. (If you're following the structure for such an app put forth by the AppWizard, those objects are owned by the CDocument-derived class. But you should get an error message bout the failure before you get the 'failed to create' error message.)

There's lots of different ways to have these problems manifest themselves, but that's what the erorr message means. You'll need to do a little debugging to detect the exact reason.

..B ekiM
Whats the context?
i_seek_ee_i_got_expertiseAuthor Commented:
Thanks mikeblas and inpras for both of your answers and comments.

Actually the application of mine was fine with an earlier approach that has been performed with only one view & one recordset.  Later,  with different approach involving three recordsets and two views, I encountered the previously said error message.

Switching between views process were carried out in the CMainFrame class using 2 different handlers:-

i. First View - View the Share Holder information; and
ii.Second View - View the Report which is in the form of query-based.

The neccessary codes found in either view handler are as follows:-

void CMainFrame::OnScreenReport()
  CRuntimeClass* pNewView;
  PNewView = RUNTIME_CLASS (CViewtheCategoryRecord1);  //View the Category Record where it applies to the option made through the menu

  CCreateContext cContext;

  cContext.m_pNewViewClass = pNewView;
  cContext.m_pCurrentDoc = GetActiveDocument();
  CView* pView = STATIC_DOWNCAST(CView, CreateView(&cContext));

  if (pView != NULL)

i_seek_ee_i_got_expertiseAuthor Commented:
Kindly assist me to debug.
Advance thanks.


The followers of Christ
December 19, 1999 - Sunday (12:20 GMT)
What messages are in your debug output window when this happens?

..B ekiM
All Courses

From novice to tech pro — start learning today.