[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] obj_Report [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] CrystalDecisions.CrystalReports.Engine.ReportDocument
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] frm_Viewer [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] frmViewReport
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] crTableLogonInfo [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] TableLogOnInfo
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] crConnectionInfo [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] ConnectionInfo
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] crTable [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] CrystalDecisions.CrystalReports.Engine.Table
[SIZE=2]
crTableLogonInfo = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] TableLogOnInfo
crConnectionInfo = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] ConnectionInfo
crConnectionInfo.DatabaseName = g_str_Database
crConnectionInfo.ServerName = g_str_Server
crConnectionInfo.UserID = g_str_Username
crConnectionInfo.Password = g_str_Password
crTableLogonInfo.ConnectionInfo = crConnectionInfo
[/SIZE][SIZE=2][COLOR=#0000ff]With[/COLOR][/SIZE][SIZE=2] obj_Report
.Load(m_str_ReportFilename)
[/SIZE][SIZE=2][COLOR=#0000ff]For[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Each[/COLOR][/SIZE][SIZE=2] crTable [/SIZE][SIZE=2][COLOR=#0000ff]In[/COLOR][/SIZE][SIZE=2] .Database.Tables
crTable.ApplyLogOnInfo(crTableLogonInfo)
[/SIZE][SIZE=2][COLOR=#0000ff]Next
[/COLOR][/SIZE][SIZE=2]crTable.Location = g_str_Database & ".dbo." & crTable.Location.Substring(crTable.Location.LastIndexOf(".") + 1)[SIZE=2]
.SetDatabaseLogon(g_str_Username, g_str_Password, g_str_Server, g_str_Database)
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]With
[SIZE=2]
[COLOR=black]frm_Viewer.crv_ReportViewer.ReportSource = obj_Report
frm_Viewer.ShowDialog()
[/COLOR][/SIZE][/COLOR][/SIZE][/SIZE][/SIZE]