-vika-
26-12-2005, 17:39
Функция "исправить" не работает, выдает ошибку
Run-time error '3265'
Объект, отвечающий заданному имени или порядковому номеру, не найден.
Private Sub Command1_Click()
' Muokkaa
Dim strSQL As String
Set Cnxn = New ADODB.Connection
strPath = lpolku
Set Cnxn = New ADODB.Connection
strPath = lpolku
strSQL = "SELECT * FROM Yhteistiedot"
strPath = lpolku
With Adodc1
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;" & _
"Persist Security Info=False;Data Source=" & strPath & _
"; Mode=Read|Write"
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.CommandType = adCmdText
.RecordSource = strSQL
.Refresh
End With
Set Tulos = Adodc1.Recordset
strSQL = "UPDATE Yhteistiedot SET " _
& "Etunimi = '" & Text1.Text & "', " _
& "Sukunimi = '" & Text2.Text & "', " _
& "Syntymaaika = '" & Text3.Text & "', " _
& "Katuosoite = '" & Text4.Text & "', " _
& "Postinumero = '" & Text5.Text & "', " _
& "Postitoimipaikka_Kaupunki = '" & Text6.Text & "', " _
& "Internet_osoite='" & Text7.Text & "' " _
& "Internet_sivujen lisatiedot='" & Text8.Text & "', " _
& "Henkilon lisatiedot='" & Text9.Text & "', " _
& "WHERE id = " & Tulos![ID]
With Cnxn
strConn = "Provider=Microsoft.Jet.OLEDB.3.51;" & _
"Persist Security Info=False;Data Source=" & strPath & _
"; Mode=Read|Write"
.Open strConn
.Execute strSQL, , adExecuteNoRecords
End With
End Sub
А функция "Добавить" -
Run-time error '-2147217900 (80040e14)'
Number of query values and destination fields aren't the same
Private Sub Command2_Click()
Dim strSQL As String
' Lisдд
strSQL = "INSERT INTO rekisteri (Etunimi, Sukunimi, Syntymaaika, Katuosoite, Postinumero, Postitoimipaikka_Kaupunki, Internet_osoite, Internet_sivujen lisatiedot, Henkilon lisatiedot) VALUES ('" _
& Text1.Text & "', '" & Text2.Text & "', '" & Text3.Text & "', '" & Text4.Text & "', '" & Text5.Text & "', '" & Text6.Text & "', '" & Text7.Text & "', '" & Text8.Text & "', '" & Text9.Text & "')"
'Debug.Print strSQL
Set Cnxn = New ADODB.Connection
strPath = lpolku
With Cnxn
strConn = "Provider=Microsoft.Jet.OLEDB.3.51;" & _
"Persist Security Info=False;Data Source=" & strPath & _
"; Mode=Read|Write"
.Open strConn
.Execute strSQL, , adExecuteNoRecords
End With
Load Form1
Form1.Show
Unload Me
End Sub
Run-time error '3265'
Объект, отвечающий заданному имени или порядковому номеру, не найден.
Private Sub Command1_Click()
' Muokkaa
Dim strSQL As String
Set Cnxn = New ADODB.Connection
strPath = lpolku
Set Cnxn = New ADODB.Connection
strPath = lpolku
strSQL = "SELECT * FROM Yhteistiedot"
strPath = lpolku
With Adodc1
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;" & _
"Persist Security Info=False;Data Source=" & strPath & _
"; Mode=Read|Write"
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.CommandType = adCmdText
.RecordSource = strSQL
.Refresh
End With
Set Tulos = Adodc1.Recordset
strSQL = "UPDATE Yhteistiedot SET " _
& "Etunimi = '" & Text1.Text & "', " _
& "Sukunimi = '" & Text2.Text & "', " _
& "Syntymaaika = '" & Text3.Text & "', " _
& "Katuosoite = '" & Text4.Text & "', " _
& "Postinumero = '" & Text5.Text & "', " _
& "Postitoimipaikka_Kaupunki = '" & Text6.Text & "', " _
& "Internet_osoite='" & Text7.Text & "' " _
& "Internet_sivujen lisatiedot='" & Text8.Text & "', " _
& "Henkilon lisatiedot='" & Text9.Text & "', " _
& "WHERE id = " & Tulos![ID]
With Cnxn
strConn = "Provider=Microsoft.Jet.OLEDB.3.51;" & _
"Persist Security Info=False;Data Source=" & strPath & _
"; Mode=Read|Write"
.Open strConn
.Execute strSQL, , adExecuteNoRecords
End With
End Sub
А функция "Добавить" -
Run-time error '-2147217900 (80040e14)'
Number of query values and destination fields aren't the same
Private Sub Command2_Click()
Dim strSQL As String
' Lisдд
strSQL = "INSERT INTO rekisteri (Etunimi, Sukunimi, Syntymaaika, Katuosoite, Postinumero, Postitoimipaikka_Kaupunki, Internet_osoite, Internet_sivujen lisatiedot, Henkilon lisatiedot) VALUES ('" _
& Text1.Text & "', '" & Text2.Text & "', '" & Text3.Text & "', '" & Text4.Text & "', '" & Text5.Text & "', '" & Text6.Text & "', '" & Text7.Text & "', '" & Text8.Text & "', '" & Text9.Text & "')"
'Debug.Print strSQL
Set Cnxn = New ADODB.Connection
strPath = lpolku
With Cnxn
strConn = "Provider=Microsoft.Jet.OLEDB.3.51;" & _
"Persist Security Info=False;Data Source=" & strPath & _
"; Mode=Read|Write"
.Open strConn
.Execute strSQL, , adExecuteNoRecords
End With
Load Form1
Form1.Show
Unload Me
End Sub