Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » MFC connect to crystal report using Microsoft Access
Closed Thread
Old 09-15-2005, 11:51 PM   #1 (permalink)
 
Newb Techie

Join Date: Sep 2005

Posts: 1

bryan523

Send a message via ICQ to bryan523
Default MFC connect to crystal report using Microsoft Access

Hi all,

I face a problem which when i run my program and click on display button,
then windows pop up "unable to open database"?

did my coding below got problem?
Quote:
void CDisplay_Crystal_RPTDlg::OnDisplay()
{
// TODO: Add your control notification handler code here
// by default the ID of the CCrystalCtrl is IDC_CRYSTALREPORT1

UpdateData(TRUE);
// by default the ID of the CCrystalCtrl is IDC_CRYSTALREPORT1
CCrystalCtrl *m_cryscontrol =
( CCrystalCtrl*)( GetDlgItem(IDC_CRYSTALREPORT1));
CString str;
str = "{Table1.ID} = 1";
// where Table1 and Name is a name and a field
//in your Database, m_StudentName is a member variable of an edit box.

m_cryscontrol->SetReportFileName("C:\\Documents and Settings\\Owner\\My Documents\\Bryan\\C++code\\Display_Crystal_RPT\\Re port1.rpt");
m_cryscontrol->SetSelectionFormula(str);
m_cryscontrol->SetDiscardSavedData(TRUE);
m_cryscontrol ->SetAction(TRUE);
UpdateData(FALSE);
}

bryan523 is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On