GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 15-Sep-2005, 21:43
bryan523 bryan523 is offline
Junior Member
 
Join Date: Aug 2005
Posts: 32
bryan523 is on a distinguished road

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?
CPP / C++ / C Code:
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\\Report1.rpt");
m_cryscontrol->SetSelectionFormula(str);
m_cryscontrol->SetDiscardSavedData(TRUE);
m_cryscontrol ->SetAction(TRUE); 
UpdateData(FALSE);
} 
  #2  
Old 16-Sep-2005, 10:32
kobi_hikri's Avatar
kobi_hikri kobi_hikri is offline
Regular Member
 
Join Date: Apr 2005
Location: Israel
Posts: 431
kobi_hikri has a spectacular aura aboutkobi_hikri has a spectacular aura about
Quote:
Originally Posted by bryan523
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"?

I once worked with crystal reports, It's great.
Did you try to output your data into another control ?
Since I don't have your rpt file I can't see if you configured the "record source" and "record type" properly ...
I recommed you creat a dummy program with data grid control and bind it to a crystal report control first.
Then, after you are sure everything is configured as supposed, you can remove the crystal report control and data grid and "code your way through" .

This is how I did it back then (with the crystal reports version that shipped with visual studio 6)

Best Regards,
Kobi Hikri.
__________________
It's actually a one time thing (it just happens alot).
  #3  
Old 20-Sep-2005, 01:24
bryan523 bryan523 is offline
Junior Member
 
Join Date: Aug 2005
Posts: 32
bryan523 is on a distinguished road
Thanks Kobi!
i manage to open the database liao!
  #4  
Old 20-Sep-2005, 01:27
kobi_hikri's Avatar
kobi_hikri kobi_hikri is offline
Regular Member
 
Join Date: Apr 2005
Location: Israel
Posts: 431
kobi_hikri has a spectacular aura aboutkobi_hikri has a spectacular aura about
Quote:
Originally Posted by bryan523
Thanks Kobi!
i manage to open the database liao!

What was the problem ?
I remember when I first used crystal reports it took me lots of time to manage the report from code only.

Glad you found the problem,
Kobi Hikri.
__________________
It's actually a one time thing (it just happens alot).
  #5  
Old 22-Sep-2005, 02:29
bryan523 bryan523 is offline
Junior Member
 
Join Date: Aug 2005
Posts: 32
bryan523 is on a distinguished road

Re: MFC connect to crystal report using microsoft Access


Quote:
Originally Posted by kobi_hikri
What was the problem ?
I remember when I first used crystal reports it took me lots of time to manage the report from code only.

Glad you found the problem,
Kobi Hikri.


The coding is rite but its the installation problem!
Install Crystal report 8.0 and the Crystl32.OCX would be registered if you do not find ( Crystal Report Control ) in the Registered Activex Controls register it manually by typing this command (regsvr32.exe Crystl32.ocx) in the console or Run.
Note: Crystl32.ocx is in the System32 else specify the path.
this can only work if and only if Other supporting files like crep32.dll etc. are on the target machine so is better if you install the Report.

Thanks Again to help me!
 
 

Recent GIDBlogWriting a book by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
D3D error when running fullscreen games/programs - help?! daa709 Computer Hardware Forum 4 01-Jul-2005 08:03
Intigrating Microsoft Access' Databases to a Web Page ObiWan506 Web Design Forum 8 31-Mar-2005 14:16
Microsoft users warned of serious flaw jrobbio Computer Software Forum - Windows 3 25-Mar-2003 08:52

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 06:51.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.