[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 605
  • Last Modified:

Access Database VS2005 Password Protected But No Username

I have an Access database that I have recently had to password protect.  I am using CR8.5 to do the reporting and it worked fine until I password protected the database.  This is the code that worked.

Dim CR As New ReportDocument
            CR.Load(reportPath) ' & ".rpt")
            Dim crParameterDiscreteValue As ParameterDiscreteValue
            Dim crParameterFieldDefinitions As ParameterFieldDefinitions
            Dim crParameterFieldLocation As ParameterFieldDefinition
            Dim crParameterValues As ParameterValues
            crParameterFieldDefinitions = CR.DataDefinition.ParameterFields
            crParameterFieldLocation = crParameterFieldDefinitions.Item("Agency Name")
            crParameterValues = crParameterFieldLocation.CurrentValues
            crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
            crParameterDiscreteValue.Value = ReportParamName
            crParameterValues.Add(crParameterDiscreteValue)
            crParameterFieldLocation.ApplyCurrentValues(crParameterValues)
            crViewer1.ReportSource = CR
            crViewer1.Show()
            Me.WindowState = FormWindowState.Normal
            Me.MaximizeBox = True

What modifications do I need to make to add in the password.  Keep in mind that I do not have a username on the Access database.  Everything that I have seen is pointing toward LOGONINFO and a username seems to be required.  This is CR8.5.
0
slink9
Asked:
slink9
  • 15
  • 6
  • 6
1 Solution
 
JimFiveCommented:
CR.Database.Tables(1).SetSessionInfo "", Chr(10) & "password"
0
 
slink9Author Commented:
It looks like that won't do it.  There is not SetSessionInfo.  I tried to do ApplyLogOnInfo with those params and get STRING CANNOT BE CONVERTED.  Other ideas?
0
 
slink9Author Commented:
This command feeds the password.

CR.SetDatabaseLogon("", "password")

but the report still prompts for a username and password when it runs.  Now the passowrd is filled in.  I will keep working around that procedure.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
JimFiveCommented:
Perhaps:

CR.Database.Tables(1).ConnectionProperties.Item("Database Password") = "passwd"
0
 
slink9Author Commented:
No ConnectionProperties, either.  Is it possible that 8.5 won't let you log into an access table without the username?  I have another program working with CR10 and it successfully connects to a protected database with only database and password sent through SetLogOnInfo.
0
 
JimFiveCommented:
The default Username for an Access database is Admin the default password is blank.  If you are using a Database Password then that is separate from the User Level Password that you are trying to set with CR.SetDatabaseLogon.  I suspect that you need to remove the CR.SetDatabaseLogon("", "password") line and replace it with something like CR.SetDatabasePassword("password") but I don't find the proper method to use to do that.
--
JimFive

0
 
JimFiveCommented:
I found the following things to try:

   CR.Connect = "PWD=mypass"
   CR.ConnectionInfo.Password = "password"

In your connection string of the report design:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\folder\PROJ.MDB;Jet OLEDB:Database Password=PASSWORD;"

--
JimFive
0
 
slink9Author Commented:
It must be prompting for a user level password.  The password from thatt command was fed into the password prompt box.  There are no user level passwords set, just a single database access password.  The program is able to feed that password into Access and use the database with no problems.  I am baffled here.
0
 
JimFiveCommented:
If you're getting the user level password, maybe try giving it the default credentials:

CR.SetDatabaseLogon("Admin", "")
0
 
slink9Author Commented:
I don't know if this is a hint, but all of these solutions (as well as the original) run fine on my development machine but will not run on a target.  There is something on the development system that is feeding the password info to CR and not prompting for it.  I thought feeding the password in the UDL may make a diff but that only made the main program blow (the password is being fed in code, of course).

No uid / pwd combos will work to get into the database for Crystal.  I have tried various things with the password box that comes up.
0
 
JimFiveCommented:
Perhaps the .DLL on the target machines is at a different version than on your develpment machine?

Is there an ODBC connection defined on the development machine that is not defined on the target?
0
 
slink9Author Commented:
I just copied the Interop and axInterop dll files over into the target directory and that didn't help either.  As far as the password difference goes, I believe that VS2005 will take care of some of the issues.  If that is the case it will explain what is happening here.
0
 
slink9Author Commented:
I am still at a loss.  Any more ideas?  Anyone?
0
 
mlmccCommented:
Are you using the same Access password (workgroup) file on both machines?

You probably need to copy the one from your development machine to the prod environment.

mlmcc
0
 
slink9Author Commented:
No workgroup file.  I have heard that CR10 is required for password protected ACCESS tables.  I am looking at upgrading to 10 for the reports.
0
 
slink9Author Commented:
I can't even find a good book or web site to use as a resource.  Any suggestions as to other resources that may help?
0
 
mlmccCommented:
How did you password protect the database?

mlmcc
0
 
slink9Author Commented:
If I open the database it asks for a password and you either know the password and have full access to all tables or you don't and have no acess.  Since there is no user level rights there is no need for a username.
0
 
mlmccCommented:
Is this an ACCESS password or is it an Active Dierectory password?

mlmcc
0
 
slink9Author Commented:
Access pwd.  No AD.  This software may be installed in a network environment but it is basically peer-to-peer style data access.
0
 
mlmccCommented:
You should be able to use Admin or no username.

mlmcc
0
 
slink9Author Commented:
I know.  That is why this is so baffling.  Nothing seems to work on the target machine yet it seems that anything works in the development environment.
0
 
mlmccCommented:
Can you remove the password then add one that has a user name?

mlmcc
0
 
slink9Author Commented:
What I have done now to see things working is remove all of the code between OpenReport and Reportsource/Viewreport.  The report loads, asks me for paramaters and then a password, and runs.  I then added back the block to set the agency name parameter and it only prompts for the date parameters plus the password.

Using this method I get OLE DB (ADO) password prompt with two "Jet System ..." options at the bottom.  Before doing this I did not have these two options.  If I take Admin out of the User ID field and type the password in the Jet Database Password spot I get a report returned.

Keep in mind that these are running and prompting without the LOGONSERVEREX line.  If I add that back with a connection string with no password appended I still get the "Not a valid password" message, no password prompt, and a blank report.

Since I have backed up and made this work, what CR10 command can I use to feed in the JET DATABASE password?
0
 
slink9Author Commented:
By the way, I have made all attempts to move this up to CR10.  Judging from the fact that it works without any connstring or logon I believe this move was successful.
0
 
slink9Author Commented:
This is finally solved, as far as I can tell.  I moved the LOGONSERVEREX to the application instead of the report and it works.
0
 
mlmccCommented:
I don't know.  I haven't used CR10 to report against an Acess database.

mlmcc
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 15
  • 6
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now