到处都有水晶报表的使用方法呀。不能正确登陆是你没有给出正确的用户名和密码造成的。
下面的代码你看一下吧,有疑问再找我。
On Error GoTo errline
'显示报表
With CR1
.Connect = ";pwd=" & Newpassword
.DataFiles(0) = App.Path & "\salford.mdb"
.ReportFileName = App.Path & "\reginfo.rpt"
.Formulas(0) = "Cname='" & MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 6) & "'"
.Formulas(1) = "regsn='" & MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 9) & "'"
.Formulas(2) = "banben='" & MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 7) & "'"
.Formulas(3) = "riqi='" & MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 4) & "'"
.Formulas(4) = "lxdh='" & MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 8) & "'"
.Formulas(5) = "regkey='" & MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 11) & "'"
.WindowState = crptMaximized
.Destination = crptToWindow
.Action = 0
End With
Exit Sub
errline:
Screen.MousePointer = vbDefault
MsgBox "Error:" & Err & " " & Err.Description
下面的代码你看一下吧,有疑问再找我。
On Error GoTo errline
'显示报表
With CR1
.Connect = ";pwd=" & Newpassword
.DataFiles(0) = App.Path & "\salford.mdb"
.ReportFileName = App.Path & "\reginfo.rpt"
.Formulas(0) = "Cname='" & MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 6) & "'"
.Formulas(1) = "regsn='" & MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 9) & "'"
.Formulas(2) = "banben='" & MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 7) & "'"
.Formulas(3) = "riqi='" & MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 4) & "'"
.Formulas(4) = "lxdh='" & MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 8) & "'"
.Formulas(5) = "regkey='" & MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 11) & "'"
.WindowState = crptMaximized
.Destination = crptToWindow
.Action = 0
End With
Exit Sub
errline:
Screen.MousePointer = vbDefault
MsgBox "Error:" & Err & " " & Err.Description
http://www.csdn.net/expert/topic/755/755275.xml?temp=.6427271