|
-
Sep 15th, 2005, 04:03 AM
#1
Thread Starter
Junior Member
connecting password protected access database in crystal reports via visual basic for
hello everybody
this problem is bothering me for last two days,i have an application in VB
with a password secured access database, in my Visual Basic application i
have added a form and am viewing crystal report... i made connection and
added fields to report but when i run it logon fails.. i have simply added
connection via wizard and have given pass word there...but when i opens the
report via Visual basic application it fails to open..i am using microsoft access as database
also i tried giving connection string : to my form load but still giving
error:
string is:
REPORT.DATABASE.LOGONSERVEREx "p2sOLEDB.DLL","PROJ.MDB
;"","","","OLEDB","PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA
SOURCE=PROJ.MDB;PERSIST
SECURITY INFO=FALSE;JET OLEDB ATABASE PASSWORD=PASSWRD"
IT GIVES DAO ERROR CODE 0XBD7
SOURCE = DAO WORKSPACE
DESCRIPTION : NOT A VALID PASSWORD..
I CHNGED CONNECTION TO ODBC AND CHANGED OLEDB ABOVE TO ODBC BUT THEN IT
GIVES ERROR SAYING ERROR IN PROVIDER IF I RUN ONLY A CRYSTAL REPORT MADE IN
CRYSTAL REPORTS 9 WITHOUT USING VISUAL BASIC IT RUNS WELL ONLY WHEN I RUN IT
FROM VB IT GIVES ERROR... PLZ HELP
AM REALLY STUCK
-
Sep 15th, 2005, 10:03 AM
#2
Re: connecting password protected access database in crystal reports via visual basic
I don't know if the connection string is case sensitive, but it's worth trying it as shown below:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\folder\PROJ.MDB;Jet OLEDB:Database Password=PASSWRD;"
Note that you should include the path to the database, otherwise it may not be found.
Also, this does not include the string: "PERSIST SECURITY INFO=FALSE;", as I do not think this is required.
-
Sep 15th, 2005, 11:12 AM
#3
Re: connecting password protected access database in crystal reports via visual basic for
Using CR9 with a secured MSAccess DB I do the following :
VB Code:
Dim ConnectionInfo As CRAXDDRT.ConnectionProperties
Dim test as String
mRepName = App.Path & "\" & mRepName
test = app.path & "\" & gDBName
Set m_Rep = m_App.OpenReport(mRepName, 1)
m_Rep.RecordSelectionFormula = mstrW
Set ConnectionInfo = m_Rep.Database.Tables(1).ConnectionProperties
On Error Resume Next
m_Rep.Database.Tables(1).DllName = "crdb_dao.dll"
ConnectionInfo.DeleteAll
ConnectionInfo.Add "Database Name", test
ConnectionInfo.Add "Session UserID", "User Name goes Here"
ConnectionInfo.Add "Session Password", "User Password goes here"
ConnectionInfo.Add "System Database Path", gstrDBLoc & "\Security.mdw" <-- Change to you security DB
In the Decare section of the form module is the following:
VB Code:
Private m_App As New CRAXDDRT.Application
Private m_Rep As New CRAXDDRT.Report
Public mRepName As String
Public mstrW As String
Public mstrUName As String
Public msRepTitle As String
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Sep 15th, 2005, 11:58 AM
#4
Thread Starter
Junior Member
Re: connecting password protected access database in crystal reports via visual basic for
i need further help if u can plz help me out with this line
ConnectionInfo.Add "System Database Path", gstrDBLoc & "\Security.mdw" <-- Change to you security DB
????????????????? am stuck plz help me asap as am in danger...
thanks
-
Sep 15th, 2005, 01:02 PM
#5
Re: connecting password protected access database in crystal reports via visual basic for
If you don't have an MDW file, you can probably just comment out that line.
-
Sep 15th, 2005, 01:48 PM
#6
Thread Starter
Junior Member
Re: connecting password protected access database in crystal reports via visual basic for
thanks alot i am progressing with my problem my report name is crsytal report1..... it gives error "Invalid TLV Record" with line
Dim ConnectionInfo As CRAXDDRT.ConnectionProperties
Dim test As String
mRepName = App.Path & "\crystalreport1.dsr"
test = App.Path & "\proj.mdb"
Set m_Rep = m_App.OpenReport(mRepName, 1)..............on this line
plz help me out its urgent
-
Sep 16th, 2005, 05:45 AM
#7
Thread Starter
Junior Member
Re: connecting password protected access database in crystal reports via visual basic for
hello evrybody in the forum...
First of all i would like to thank Gary Mazzone for all the help and suggestions and i am able to solve the problem by following his method...thanks a lot Gary..
thanks to si the geek ...(the super moderator ) for all the valuable inputs and suggestions..
thanks again..
-
Feb 1st, 2008, 12:06 AM
#8
New Member
Re: connecting password protected access database in crystal reports via visual basic
hello Sir,
I m facing same problem as like u,DAO workspace and password not valid
my code is as
Dim ConnectionInfo As CRAXDDRT.ConnectionProperties
Dim test As String
str = App.Path & "\CrystalReport2.dsr"
test = App.Path & "\DB\Utm.mdb"
Set App1 = New CRAXDRT.Application
Set Report1 = Report.OpenSubreport("CrystalReport1")
For n = 1 To Report1.Database.Tables.Count
Set ConnectionInfo = Report1.Database.Tables(n).ConnectionProperties
Report1.Database.Tables(n).DllName = "crdb_dao.dll"
Report1.Database.Tables(n).SetLogOnInfo "", App.Path + "\DB\Utm.mdb", "Admin", "becool"
Report1.Database.Tables(n).SetSessionInfo "", Chr$(10) & "becool"
Report1.Database.Tables(n).Location = App.Path + "\DB\Utm.mdb"
Next n
ConnectionInfo.DeleteAll
str1 = "PROVIDER=MSDASQL.1;USER ID=ADMIN;DATA SOURCE=MS ACCESS DATABASE;INITIAL CATALOG= " & App.Path & "\DB\UTM.MDB;"""
ConnectionInfo.Add "Database Provider", "MSDASQL.1" '"MICROSOFT.JET.OLEDB.4.0"
ConnectionInfo.Add "Database ConnectionString", str1 '"Provider=MSDASQL.1;User ID=Admin;Data Source=MS Access Database;Initial Catalog= " & App.Path & "\DB\Utm.mdb;"""
ConnectionInfo.Add "Database Name", test
ConnectionInfo.Add "Databse Password", "becool"
ConnectionInfo.Add "Session UserID", "Admin"
ConnectionInfo.Add "Session Password", "becool"
ConnectionInfo.Add "System Database Path", "C:\Program Files\Microsoft Office\Office\SYSTEM.MDW"
Set Report1 = App1.OpenReport(str, 1)
CRViewer91.ReportSource = Report1
CRViewer91.Refresh
CRViewer91.Zoom (10)
CRViewer91.ViewReport
it gives error at viewreport
pls help me
bye i m stucking here...............
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|