Salve!
Ho scritto il seguente codice VB6
FORM 1:
Dim f1(1 To n) As Form
Dim rsA(1 To 10) As New ADODB.Recordset
.
.
.
Private SUb Form_Load()
.
.
.
cnA.CursorLocation = adUseClient
If cnA.state = adStateOpen Then cnA.Close
cnA.Open "Provider=Microsoft Jet 4.0 OLE DB Provider;Data Source=" & strDBFile & ";" & _
"Jet OLEDB: Database Password=" & strDBPassword
.
.
.
End SUb
Private Sub menu_CLick()
.
.
.
Set f1(fn1) = New Form2 ' istanzio Form2
Set rsA(fn1) = New ADODB.Recordset ' istanzio Recordset
With rsA(fn1)
.ActiveConnection = cnA
.CursorLocation = adUseServer
.CursorType = adOpenKeyset
.LockType = adLockReadOnly
.Properties("IRowsetIdentity") = True
.Open "SELECT Pratiche.*, ... ", , , adCmdText
End With
f1(fn1).setRs rsA(fn1) ' passo il Recordset all'istanza di Form2
f1(fn1).Show
f1(fn1).SetFocus
End Sub
FORM 2:
Dim rsB As ADODB.Recordset
.
.
.
Private Sub Form_Load()
.
.
.
If cnA.state = adStateOpen Then cnA.Close
cnA.Open "Provider=Microsoft Jet 4.0 OLE DB Provider;Data Source=" & strDBFile & ";" & _
"Jet OLEDBatabase Password=" & strDBPassword
If rsB.BOF And rsB.EOF Then
.
.
.
End SUb
Public Sub setRs(ByVal rs As ADODB.Recordset)
Set rsB = New ADODB.Recordset
Set rsB = rs
End Sub
Al click sul menu viene generato l'errore di run-time '91':
Variable oggetto o variabile nel blocco With non impostata
in corrispondenza di
If rsB.BOF And rsB.EOF Then
in Form2
Ho scritto il seguente codice VB6
FORM 1:
Dim f1(1 To n) As Form
Dim rsA(1 To 10) As New ADODB.Recordset
.
.
.
Private SUb Form_Load()
.
.
.
cnA.CursorLocation = adUseClient
If cnA.state = adStateOpen Then cnA.Close
cnA.Open "Provider=Microsoft Jet 4.0 OLE DB Provider;Data Source=" & strDBFile & ";" & _
"Jet OLEDB: Database Password=" & strDBPassword
.
.
.
End SUb
Private Sub menu_CLick()
.
.
.
Set f1(fn1) = New Form2 ' istanzio Form2
Set rsA(fn1) = New ADODB.Recordset ' istanzio Recordset
With rsA(fn1)
.ActiveConnection = cnA
.CursorLocation = adUseServer
.CursorType = adOpenKeyset
.LockType = adLockReadOnly
.Properties("IRowsetIdentity") = True
.Open "SELECT Pratiche.*, ... ", , , adCmdText
End With
f1(fn1).setRs rsA(fn1) ' passo il Recordset all'istanza di Form2
f1(fn1).Show
f1(fn1).SetFocus
End Sub
FORM 2:
Dim rsB As ADODB.Recordset
.
.
.
Private Sub Form_Load()
.
.
.
If cnA.state = adStateOpen Then cnA.Close
cnA.Open "Provider=Microsoft Jet 4.0 OLE DB Provider;Data Source=" & strDBFile & ";" & _
"Jet OLEDBatabase Password=" & strDBPassword
If rsB.BOF And rsB.EOF Then
.
.
.
End SUb
Public Sub setRs(ByVal rs As ADODB.Recordset)
Set rsB = New ADODB.Recordset
Set rsB = rs
End Sub
Al click sul menu viene generato l'errore di run-time '91':
Variable oggetto o variabile nel blocco With non impostata
in corrispondenza di
If rsB.BOF And rsB.EOF Then
in Form2
Ultima modifica: