lucausa75
14-10-2010, 15:34
Salve ragazzi,
cos'è che mi crea l'errore in questa sub che gira nell'evento Form_Load di un form?
Vedi immagine sotto il codice...
Private Sub VerificaRegistrazione(ByVal DB As String, ByVal TB As String, ByVal MySeriale As String, ByVal MyForm As Form)
Dim StrCnn As String
Dim StrSql As String
CnnReg = New ADODB.Connection
RstReg = New ADODB.Recordset
Tabella = TB
StrCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & Application.StartupPath & _
"\" & DB & ";Jet OLEDB:Database Password=pass"
CnnReg.Open(StrCnn)
StrSql = "SELECT * FROM " & TB & " WHERE NumeroSeriale = '" & MySeriale & "'"
RstReg.CursorType = ADODB.CursorTypeEnum.adOpenStatic
RstReg.CursorLocation = ADODB.CursorLocationEnum.adUseClient
RstReg.Open(StrSql, CnnReg)
If RstReg.RecordCount > 0 Then
Me.Hide()
Else
MyForm.Show()
End If
End Sub
http://img835.imageshack.us/img835/8733/42525092.th.png (http://img835.imageshack.us/i/42525092.png/)
Grazie!
cos'è che mi crea l'errore in questa sub che gira nell'evento Form_Load di un form?
Vedi immagine sotto il codice...
Private Sub VerificaRegistrazione(ByVal DB As String, ByVal TB As String, ByVal MySeriale As String, ByVal MyForm As Form)
Dim StrCnn As String
Dim StrSql As String
CnnReg = New ADODB.Connection
RstReg = New ADODB.Recordset
Tabella = TB
StrCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & Application.StartupPath & _
"\" & DB & ";Jet OLEDB:Database Password=pass"
CnnReg.Open(StrCnn)
StrSql = "SELECT * FROM " & TB & " WHERE NumeroSeriale = '" & MySeriale & "'"
RstReg.CursorType = ADODB.CursorTypeEnum.adOpenStatic
RstReg.CursorLocation = ADODB.CursorLocationEnum.adUseClient
RstReg.Open(StrSql, CnnReg)
If RstReg.RecordCount > 0 Then
Me.Hide()
Else
MyForm.Show()
End If
End Sub
http://img835.imageshack.us/img835/8733/42525092.th.png (http://img835.imageshack.us/i/42525092.png/)
Grazie!