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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access database-password with CrViewer

Status
Not open for further replies.

Flupke

Programmer
Jun 26, 2002
94
BE
After a few years of using the Crystal OCX, I start working with the CrViewer.
Can someone please tell me how I can access a password-protected Access database through Visual Basic 6 code?

The code I already wrote is:

Dim rptToepassing As CRAXDRT.Application
Dim rptRapport As CRAXDRT.Report

Screen.MousePointer = vbHourglass

Set rptToepassing = CreateObject("CrystalRuntime.Application")
Set rptRapport = rptToepassing.OpenReport(gsRapportenpad & gsRapportnaam)


crViewerDienstrooster.DisplayGroupTree = False
crViewerDienstrooster.DisplayTabs = False
crViewerDienstrooster.EnableAnimationCtrl = False
crViewerDienstrooster.EnableCloseButton = False
crViewerDienstrooster.EnableExportButton = True
crViewerDienstrooster.EnableGroupTree = False
crViewerDienstrooster.EnableRefreshButton = False
crViewerDienstrooster.EnableStopButton = False

rptRapport.PaperOrientation = crPortrait

crViewerDienstrooster.ReportSource = rptRapport
crViewerDienstrooster.ViewReport
crViewerDienstrooster.Zoom 1

Screen.MousePointer = vbDefault

What do I have to add to access the pasword-protected database?
Any tips to improve the code above is greatly appreciated.

Many thanks and greetings from Brugge (Bruges - Belgium),

Michel
 
Which version of Crystal?

How are you connecting to the Access database?

Here's the CR whitepaper:


Here's some more reading:



Posting specifics will net more tailored results, but I think that this should resolve.

-k
 
I'd like to start with the new Crystal Reports version 10. Are there specific documents for that version on how to implement RDC into a Visual Basic version 6 program and also how to pass parameters and database passwords for an Access 2003 database.

Many thanks and greetings from Brugge (Bruges - Belgium),

Michel
 
Thank you for your help.

I use the example in addcrviewer.zip to display my reports. That works fine for access-databases without database-password.

To use a password: I looked at the examples in ms_access_password.zip as you suggested.

Two questions. Is the crViewer in Version 10 of Crystal Reports only available if added at runtime like in the examples in addcrviewer.zip? I thought you could put a viewer-control on a VB-form in version 9? Is that control no longer available in version 10?

In the password examples, the reports are displayed through a crystal-designer. I do not use that. Can I use the same code from the password examples in combination with the use of the crViewer as shown in addcrviewer.zip? If so, how do I combine those codes?

When I try to combine them, I get an error message telling me:
Logon failed. Details: ADO error-code 0x800300fb. Source: Microsoft OLE DB Service Components. Description: the file is not a valid composed file (the last sentence in Dutch. I tried to translate!).

Must the pasword be set for each table that appears in the database or is one setting of the password enough for the whole database?

Many thanks and greetings,

Michel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top