Public RST As New ADODB. You
Public connectString As String
Public oApp As New CRAXDRT. Application
Public cnnlocal As New ADODB. Connection
Public oRpt As CRAXDRT. Report
Public reportName As String
Private Sub Form_Load ()
"' On Error GoTo OpenDataErrHandler
ConnectLocalStrnig="Provider=SQLOLEDB. 1; Password=mima123; Persist Security Info=True; User ID=sa; Initial Catalog=JYY; Data Source=192.168.100.1 "
If cnnlocal. State=adStateOpen Then
Cnnlocal. Close
End the If
With cnnlocal
The ConnectionString=connectLocalStrnig
. CommandTimeout=10
. CursorLocation=adUseClient
. Open
End With
Dim txtSQL As String
TxtSQL="select * from SaleCt"
RST. Open txtSQL, cnnlocal adOpenDynamic, adLockReadOnly
Screen. MousePointer=vbHourglass
ReportName="\ Rpt \ SaleCt Rpt"
The Set oRpt=oApp. OpenReport (App) Path & amp; ReportName, 1)
ORpt. DiscardSavedData
ORpt. Database. SetDataSource RST
CRViewer91. Width=Me. Width - 150
CRViewer91. Height=Me. Height - 150
CRViewer91. ReportSource=oRpt
CRViewer91. Refresh
CRViewer91. ViewReport
Screen. MousePointer=vbDefault
The Exit Sub
CodePudding user response:
![](https://img.codepudding.com/202009/89972202317321.png)
CodePudding user response:
The error code in the baidu search prompt box,CodePudding user response:
Template and check the number in the table are inconsistent, or, the process can not be put into the LOAD, must form after loading, in carrying out!!!