Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Urgent !! Pl. Help ! ODBC logoninfo (VB6 and RDC)

Status
Not open for further replies.

ksraju6

Programmer
Jul 12, 2001
22
US
Hi

Thanks in advance.

Pl. Tell me where am i going wrong ?????

I need to access more than 50 reports using VB as front end. I am not doing any validations for these reports except some of them have parameters .

First i wanted to try with one report as a sample report which has only one parameter i.e date.

I am using ODBC for Oracle Database.
My DSN = CR_aixhrprod
User ID = AMS_JRSLIGER
Pass Word = dflt1234

when I am executing this following code . I am getting an error reads

" VB6.exe has generated errors and will be closed by windows. You will need to restart the program.
An error log has been created."

in the log i found the details of Exception number: c0000005 (access violation).

The following is the code in two forms

form1 i.e command button form
frmthursday i.e crystal viewer form
------------------------------------------------
Here is the code :

when I am accessing a report thru a command button:
when the user clicks on this command button the report path is taken in in to a variable and leads to the next form.i.e
frmthursday , the report viewing form.

----------------------
Private Sub CmdPA0001_Click()
strReportPath = "G:\COPYAREA\BCPS Crystal Approved Reports\monday"
& CmdPA0001.Caption
frmthursday.Show
MsgBox "PA0001"
End Sub
-----------------------------------------------

Code of frmthursday ( this is the form where i show all my reports)

------------------------------------------------
Private Sub Form_Load()
Set CrxReport = CrxApplication.OpenReport(strReportPath)
ConnectionStr = "Provider=MSDASQL.1;Password=dflt1234;Persist Security
Info=True;UserID=AMS_JRSLIGER;Data Source=CR_aixhrprod"
CrxReport.Database.AddOLEDBSource ConnectionStr, ConnectionTable

CRViewer1.ReportSource = CrxReport

CRViewer1.ViewReport

' Loop while the report is viewed.
' Use DoEvents to allow the operating system to take control while the
report is viewed.

While CRViewer1.IsBusy
DoEvents
Wend

End Sub
---------------------------------------

Private Sub Form_Resize()
CRViewer1.Top = 0
CRViewer1.Left = 0
CRViewer1.Height = ScaleHeight
CRViewer1.Width = ScaleWidth
End Sub
-----------------------------------------


Variable declarations in the class modules :

Option Explicit

' Declare RDC objects and other project variables
Public strReportPath As String
'The Application object is used to open an external RPT file as a Report
object.
Public CrxApplication As New CRAXDRT.Application
Public CrxReport As CRAXDRT.Report
Public crxParameterFields As CRAXDRT.ParameterFieldDefinitions
Public crxParameterField As CRAXDRT.ParameterFieldDefinition

'Dimension other variables
Public FileLocation As String
Public FileName As String
Public crxDatabase As CRAXDRT.Database
Public crxDatabaseTables As CRAXDRT.DatabaseTables
Public crxDatabaseTable As CRAXDRT.DatabaseTable


________________________________________________

1)Was that the correct way to give ODBC logon information to the report ?

2) Do I need to pass the parameters also to the report from my VB ?
If yes, Do i need to code for all these 50 reports

3) Pl. Send me a sample code.

Please help me.

Raj
732-277-8181
sudhakark@keyusa.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top