Skip to Content
Former Member
Apr 11, 2008 at 11:04 AM

VS 2005 VB - MS ACCESS 2007 - Crystal Report XI R2 "Error: Logon failed.." Please help!!


Is there anybody there have an idea to resolve this vb to crystalreport XI connection problem...

Im using VS2005 VB and MS ACCESS '07 and Crystal Report XI R2

Here's my code


Private Sub frmCrystalReport_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load



Me.Cursor = Cursors.WaitCursor

Me.MdiParent = frmMain

crxApp = New CRAXDRT.Application

crxReport = crxApp.OpenReport(strCRSourcePath, CrystalDecisions.Shared.OpenReportMethod.OpenReportByDefault)

crxDataBase = crxReport.Database

crxTables = crxDataBase.Tables

For Each crxTable In crxTables

crxTable.Location = DataSource 'My .mdb source path

crxTable.SetLogOnInfo("Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & crxDataBasePath, "dbEmployee.mdb", "", "00019136392852")

Next crxTable

'**** Note:

'When ever i used this recordSelectionFormula? it works properly

'and it get connected and show the report but then this

'recordSelectionFormula is something limited for filtering data thats

'why i need to use more flexible filter like CRXDRT.Report.SqlQueryString

'but then my problem is the login connection from the database is somewhat failed...


'this RecordSelectionFormula works

'crxReport.RecordSelectionFormula = strSelectionfrm

'this SQLQueryString failed.. why?? what's the different?

crxReport.SQLQueryString = strSqlQuery

AxCRViewer1.ReportSource = crxReport


Catch ex As Exception



Me.Cursor = Cursors.Default

End Try

End Sub


here's my "strSelectionfrm"


strSelectionfrm = "{CmpnyDetails.IDNo} like '*' and {tblCompanyDetails.Status} = 'REGULAR' and {Attendance.AFrom} in #" & Format(DatePickerFrom.Value, "MM/dd/yyyy") & "# to #" & Format(DatePickerTo.Value, "MM/dd/yyyy") & "#"


and here's my "strSqlQuery"


strfilter = strfilter = "Select * from CmpnyDetails as cd left outer join Attendance as att on att.IDNo = cd.IDNo where (att.AFrom Between #" & Format(DatePickerFrom.Value, "MM/dd/yyyy")

& "# and #" & Format(DatePickerTo.Value, "MM/dd/yyyy") & "#) and cd.[Status] = 'REGULAR' and cd.IDNo like '*'"


Please anybody can help or any idea with this?...


a lot of appreciation in advance....