|
 |
activex_data_objects thread: ADO - Building an active control
Message #1 by "Ken McIntosh" <ken.mcintosh@s...> on Tue, 26 Jun 2001 15:37:35
|
|
Hi
I'm trying to build an active x control that allows me to add records to a
database that I have entered in the txt boxes I then select the addrecord
command button. However, I get the following error message from the code
below (Run-time error '2147217873(8004oe2f) [Microsoft][ODBC Microsoft
Access Driver]Error in Row.
This happens when the code tries to run the rs.Update method.
Any ideas..
Thankyou
Ken
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Private Sub UserControl_Initialize()
cn.Open "DSN=IP"
'OPEN A RECORDSET
Set rs = New ADODB.Recordset
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic
rs.Source = "version2"
rs.ActiveConnection = cn
rs.Open
End Sub
Private Sub UserControl_Resize()
With UserControl
'Enfore minimum dimensions
If .Height < 9000 Then .Height = 9000
If .Width < 7920 Then .Width = 7920
'Resize the objects on the control
txtSwVer.Width = .ScaleWidth - 500
txtProdName.Width = .ScaleWidth - 500
End With
End Sub
Public Property Get AddressText() As String
Dim s As String
s = txtSwVer
s = s & txtProdName & vbCrLf
s = s & txtProdID & vbCrLf
s = s & txtSupCont & vbCrLf
IPText = s
End Property
Private Sub cmdCommit_Click()
rs.AddNew
rs.Fields("ProductName") = txtProdName
rs.Fields("ProductID") = txtProdID
rs.Fields("SWVersion") = txtSwVer
rs.Fields("SupportContact") = txtSupCont
rs.Update
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing
End Sub
Message #2 by "Pat and Kelley Flanders" <flanders@m...> on Tue, 26 Jun 2001 09:05:57 -0700
|
|
If you use this in conjunction with a stored procedure containing a dbDate
field, try changing it to dbTimeStamp.
Pat Flanders
-----Original Message-----
From: Ken McIntosh [mailto:ken.mcintosh@s...]
Sent: Tuesday, June 26, 2001 3:38 PM
To: ActiveX_Data_Objects
Subject: [activex_data_objects] ADO - Building an active control
Hi
I'm trying to build an active x control that allows me to add records to a
database that I have entered in the txt boxes I then select the addrecord
command button. However, I get the following error message from the code
below (Run-time error '2147217873(8004oe2f) [Microsoft][ODBC Microsoft
Access Driver]Error in Row.
This happens when the code tries to run the rs.Update method.
Any ideas..
Thankyou
Ken
|
|
 |