1 Attachment(s)
[RESOLVED] How to set database location via code in Crystal Report XI....?
Hi..VBForumers,
I am using the following items in my s/w....
------------------------------------------------------
Reporting Toolkit: Crystal Report (CR 11).
S/W Front End: Visual Basic 6.0 with Service Pack 6
Back End RDBMS: Microsoft Access 2000
------------------------------------------------------
I am almost done with CR 11 and its integration into my s/w. Great Thanks !! to some really experienced VBForumers.
NEW ISSUE:
=========
I have successfully been able to create a Visual Basic 6 s/w which can generate reports based on user selected information from a form at runtime, with the criteria that CR 11 product is not required to be installed on the clien'ts / end-user's PC.
But... just before the report is going to genereate itself, I get a dialog box window that pops-up asking for the exact location of the .MDB datbase file. This dialog box has a BROWSE button by which i can locate the database file manually, thus inturn the report is generated. I have attached an image showing this pop-up box.
QUESTION:
=========
But this is not the way I want it to work. I mean why is it not getting the database location via code, even though i have used ....App.Path syntax ??
This is not the only code, there's much more but I dont think that is related to this issue....
Code:
Dim rpt As New CRAXDDRT.Report
rpt.Database.SetDataSource (App.Path & "\XYZ.mdb")
.ReportSource
.ViewReport
Explanation:
=========
In the code snippet above, " rpt " is the Report object.
The second line is the syntax i have used for locating the .MDB database file via code. Is it incorrect ??
The ".ReportSource" & ".ViewReport" props display the report.
Awaiting urgent response....
Re: How to set database location via code in Crystal Report XI....?
I always make crystal report in the VB 6.0.What are you using the DSN or connection string?
Re: How to set database location via code in Crystal Report XI....?
Shakti,
I am not using any DSN or conenection string...
I am using the " .Database.SetDataSource " prop to locate the MDB file via code..
I used the Report Designer IDE in the Crystal Report 11 product (not in VB6).
What do i do ??
Awaiting status....
Re: How to set database location via code in Crystal Report XI....?
Quote:
I am not using any DSN or conenection string...
I am asking about the project what are using in the project.??
Re: How to set database location via code in Crystal Report XI....?
which project type r u refering to....VB 6 or CR11 ???
Re: How to set database location via code in Crystal Report XI....?
Shakti, i told u that i have used the Report Designer IDE in the Business Objects product: Crystal Report 11 Dev Ed. And then saved my reports as .RPT files
And i have written some code. It displays fine.
But just before displaying, it pops up the "connection manager" for locating the .mdb file. I think becoz its not being able to find it itself.
Now pls follow the 4 line code snippet, i have shown above and tell me what is wrong....Is it something to do with the second code line....??
Awaiting really urgent reply....
Re: How to set database location via code in Crystal Report XI....?
Are you running our project using the DSN??, for connection the database
Re: How to set database location via code in Crystal Report XI....?
no Shakti..i am not using any DSN thing....
I just followed ur VB6 Code Bank stuff and even there, u have not mentioned any DSN stuff.....
Pleeaassseee yaaarr Messenger par aajaa..its too urgent...!
Re: How to set database location via code in Crystal Report XI....?
Read the first post again. In the Crystal report tutorial
Re: How to set database location via code in Crystal Report XI....?
Shakti...I have finally been able to locate the 2 specific sections of ur code snippets in the VBFOrums Code Bank.
I found these two sections and i think this is wat ur referring to that relates to my case:
10) Database connection
1) Add Dsn run Time (at bottom of site)
I wanted to know that, will my report work properly if i JUST use ONLY the point (10) code snippet along with my remaining CR 11 coding which already exists ???
NOTE I am not taking into account -->
" 1) Add Dsn run Time (at bottom of site) " topic above.
Re: How to set database location via code in Crystal Report XI....?
Check out this thread which asked the same question.
http://www.vbforums.com/showthread.php?t=455123
Re: How to set database location via code in Crystal Report XI....?
brucevde...pls pls help me out...i am really not been able to understand the code for the links that u have provided ..
This issue is for generating reports at the destination PC, where the CR 11 product is not installed. I have designed my reports in CR 11 product using the Report Designer IDE(not the standard wizard). And have saved it as .RPT extension.
My issue is that, everything is fine with my reports.
They are generated, using user selected values from the vb form. I am passing respective sql statements using the .SQLQueryString property for querying records onto the report...fine!
I have even packed in the merge modules as needed. BUT...
At the desitnation PC, its asking for database (.mdb) file by popping up the CONNECTION MANAGER dialog box. And when i select that .MDB file, the report gets displayed perfectly also.
Now..why is this MANAGER window comming, i think becoz, i created a new ACCESS coonnection in CR 11 product..
I am sending u my code of a single form that would generate a report at run time via the FORM_LOAD( ) event. NOTE: THere is no CRViewer control attched nor is any references embedded. Please please modify the code so that this MANAGER windows stops comming....This window is torcherring me now..hahaha..Its simpl ecode for u. There is no syntax error with my code..i have checked that. Just add that code segment which will provide standalone database support for a .mdb file.
I will also be going thru ur modified code in the form and may need to ask u somethings to clear my doubts....Ur help is definately appreciated by me !!
I am attching 2 versions of the same code, a txt version and a frm version.
Please add the standalone db connection stuff and resend it back to me for validation.
Awaiting ur response urgently.
Re: How to set database location via code in Crystal Report XI....?
SHAKTI..AND BRUCEVDE.....wherer the replies.....its urgent pls assist me guys..
Re: How to set database location via code in Crystal Report XI....?
Not trying to be a jerk but I am sure these people have jobs of thier own to work on. You can't expect them to be constantly helping you instantaneously.
Re: How to set database location via code in Crystal Report XI....?
Hey Besoup...now u have to just pull me out of this rut in CR...
come on man...can u help me atleast..please.....???
Re: How to set database location via code in Crystal Report XI....?
Quote:
Please add the standalone db connection stuff and resend it back to me for validation.
The samples/links posted already have the code you need. I don't mind helping but I won't write the program for you.
Look at the code in Post #38 from the Thread I posted earlier.
Re: How to set database location via code in Crystal Report XI....?
Bruce and Shakti supplied you with the links... You need to look at them and understand them. They are here to help, not write the program for you.
Yet to test sorry...for a blank one..
Pls bare with me ..this was a mistake to click a blank one..
Re: How to set database location via code in Crystal Report XI....?
Hi..buddy,
Thanks a lot guys for ur willingness to assist me when i really needed it.
The Crystal Report connection manager issue has been kicked off forever...
I tested it on 3 PC's w/o the CR 11 product being installed.
My special thank you list for this post includes:
SHAKTI5385 - for his Code Bank.
BRUCEVDE - For ur Set statement post# 38...AWESOME!
BESOUP - For re-building the relations with reference to the past.
3 cheers for u guys....!!;) ;)
T.H.A.N.X.!! :wave: :wave: :wave: