PDA

Click to See Complete Forum and Search --> : Passing User ID and Password to Crystal Reports [RESOLVED]


Daywalker46410
Feb 2nd, 2004, 10:18 AM
I am using a VB program to call a pre-designed Crystal Reports report that connects to an AS400 Database on ODBC. Not all users will have the same access to the files in the AS400 database that they would need to run the report, so I want either VB or Crystal to supply my user ID and password. I set up the ODBC connection to use my AS400 user ID, but can't find anywhere to pass my password. Does anyone know of a way, either in Visual Basic; ODBC for AS400; or the Crystal Report itself, to tell the report to use my user ID and password?

Thanks in advance.

ahpaul
Feb 9th, 2004, 09:39 AM
http://www.vbforums.com/showthread.php?s=&threadid=135278&highlight=connection+AS400

http://www.vbforums.com/showthread.php?s=&threadid=107734&highlight=connection+AS400

I use a DSN connect to MSAccess DB something like this


Public cn As New ADODB.Connection
Public rc As New ADODB.Recordset
Public sql As String

cn.Open "DSN=Reporting", "Admin", "password"


The report I do as I pass the recordset to the report template (TTX)



Public crApp As New CRAXDRT.Application
Public crRep As CRAXDRT.Report

sql = "SELECT * FROM CUSTOMER"
rc.open sql, cn

Set crRep = crApp.OpenReport(App.Path & "\Invoice.rpt")

With crRep
.Database.SetDataSource rc
.PaperSize = crPaperFanfoldUS

End With
frmPreview.Show


For TTX files, you can search the forums

Daywalker46410
Feb 9th, 2004, 11:30 AM
Thanks. Someone else suggested using the CR Viewer's Connect property to pass the report an ODBC connection string. That seems to be working fine.