Click here to Skip to main content
15,891,785 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm getting a logon error and not sure why. I'm trying to launch crystal using ADO connection.
The code is in Access / VB and the Access db extention is .accdb

VB
Dim crxApplication As CRAXDRT.Application
Dim report As CRAXDRT.report

CrViewer1.DisplayBorder = False          'MAKES REPORT FILL ENTIRE FORM
CrViewer1.DisplayTabs = False            'THIS REPORT DOES NOT DRILL DOWN, NOT NEEDED
CrViewer1.EnableDrillDown = False        'REPORT DOES NOT SUPPORT DRILL-DOWN
CrViewer1.EnableRefreshButton = False    'ADO RECORDSET WILL NOT CHANGE, NOT NEEDED

Set crxApplication = New CRAXDRT.Application
Set report = New CRAXDRT.report
Set report = crxApplication.OpenReport("P:\Inventory\Reports\Test.rpt")

report.DiscardSavedData

'report.Database.Tables.Item(1).SetLogOnInfo "P:\Inventory\Test\", "Spawntestbe", "admin", ""
report.Database.Tables.Item(1).SetLogOnInfo "", "", "admin", ""

CrViewer1.ReportSource = report
CrViewer1.Height = 13000
CrViewer1.Width = 14000
CrViewer1.ViewReport
Posted
Updated 3-Oct-13 5:20am
v3
Comments
Kschuler 3-Oct-13 11:21am    
It may be helpful if you could give us the exact error message.

1 solution

Check this
C# Crystal Reports Dynamic Logon parameters[^]

EDIT
---------
I'm an idiot.

Based on your code, you forgot to uncomment/comment the SetLogOnInfo lines.
VB
'report.Database.Tables.Item(1).SetLogOnInfo "P:\Inventory\Test\", "Spawntestbe", "admin", ""
report.Database.Tables.Item(1).SetLogOnInfo "", "", "admin", ""

Because report needs the database file to connect but in above uncommented line, those fields're empty. So I think you should comment the below line & uncomment the above line(which has db details).
 
Share this answer
 
v2
Comments
Member 10313251 3-Oct-13 10:24am    
I'm not accessing a sql database but MS Access Tables. There is not server name etc., By the way the code is Access / VB
thatraja 3-Oct-13 10:37am    
Check my updated answer
Member 10313251 3-Oct-13 13:43pm    
I tried both lines with no luck. I tried other ways as well and still had the issue.
thatraja 4-Oct-13 3:01am    
what's the complete error message, if possible share screenshot
Member 10313251 4-Oct-13 14:38pm    
It just says logon failed. Nothing else. The string does match the Properties settings in Crystal Reports \ Set Datasource Location

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900