By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,336 Members | 2,315 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,336 IT Pros & Developers. It's quick & easy.

help required for inserting fields with the help of ADODB

P: 21
i am not able to add records with the help of ADODB. what is the problem i am not able to understand please help me. this is the code i written

In General Declaration

Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset

Private Sub Form_Load()
Set rs = New ADODB.Recordset
rs.LockType = adLockBatchOptimistic
rs.CursorType = adOpenKeyset
rs.ActiveConnection = cn
rs.Source = "select * from t"
End sub

Private Sub Command3_Click()
rs.Fields(0) = Text1.Text 'text1.text is character type data
rs.Fields(1) = Val(Text2.Text) 'text2.text is number type data
rs.Fields(2) = Val(Text3.Text) 'text3.text is number type data
End sub

please solve my above code.
Apr 13 '07 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 1,017
Change adOpenKeySet to adOpenDynamic.

It is just a logical guess I didn't try it.

adOpenKeySet has a static set of primary keys and you are trying to insert a new one.

Hope it helps.
Apr 13 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.