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

Logon Failed error when changing db location

Status
Not open for further replies.

MichaelaLee

Programmer
May 3, 2004
71
US
Hi Everyone.
I'm trying to move a msAccess database to the server and I'm getting the following error from the CRVeiwer:
Logon Failed
Details: ADO Error code: 0X80004005
MSDataShape
Data provider could not be initialized
SQL State: 3024
Native Error: 31
Now, when I connect to the data through the report designer and cr itself, everything seems fine, but when I try to set the locations in code, I get the above error. Here is the code:

Public Sub OpenReport(pReportType As ReportType, Optional FromDate As Date, Optional ToDate As Date)
On Error GoTo Err
Dim cString As String
Dim crxDBTables As CRAXDRT.DatabaseTable
lpReportType = pReportType
cString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
App.Path & "\MaintainaceTracker1.mdb;Persist Security Info=False"

Select Case pReportType
Case rpPrograms
For Each crxDBTables In crOrdersByProgram1.Database.Tables
crxDBTables.ConnectionProperties("Data Source") = App.Path & "\MaintainaceTracker1.mdb"
crxDBTables.ConnectionProperties("Password") = ""
crxDBTables.ConnectionProperties("User Id") = ""
crxDBTables.ConnectionProperties("Provider") = "Microsoft.Jet.OLEDB.4.0"
Next
CRViewer91.ReportSource = crPrograms
End Select
Screen.MousePointer = vbHourglass
CRViewer91.ViewReport
Screen.MousePointer = vbDefault
Exit Sub
Err:
MsgBox Err.Description

End Sub

I've tried many things that I've found online and in the manuals, but still having the problem. There is no password set for this database, so not sure whats going on. In run mode I have the following setting in the report.
Data Source = C:\Projects\MaintainaceTracker\MaintainaceTracker.mdb

Provider = MSDataShape
after I change the settings, I get
Data Source = C:\Projects\MaintainaceTracker\MaintainaceTracker1.mdb

Provider = Microsoft.Jet.OLEDB.4.0

Can someone please give me a hand. Thank you.
Michael Lee
 
Hi Everyone,
I'm still struggling with this darn problem. I have used many different ways of trying to set the new db location but it all comes up short. Here are a few things I tried.
I tried using the SetDataSource function and passed it a select query of the table it needs (Select * from Products). I get an error "This app has requested the runtime to terminate it in an unsual way, please contact the app's support team for more info." and VB closes (if in the compiled app, it closes). Can someone please help. By the way, caption in the title bar of the error message is "Microsoft Visual C++ Runtie Library".
Thanks for any info that you can provide.
Michael Lee

 
I tried to duplicate your problem a few hours ago, and got the same result (C++ Runtime Library error). Are you locked in to using the DataEnvironment? That certainly seems to be what Crystal is at odds with.

I haven't had a whole lot of time to play around with 9.0 yet, but I've managed to get it to crash the VB IDE more times in the past 2 months than CR 8.5 crashed it in 3+ years.

-dave
 
Hi Vidru,
I agree. I've been having alot of problems with CR9 shutting down vb. I even downloaded all the availible patchs. Its very strange. But I'll see if getting red of the data enviroment takes care of the problem. Thanks.
Michael Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top