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

help me Add new records

P: 38
Alem
Hellow all!!

I tried to Add New recored , my code is:-

Private Sub mnuconp_Click()
Dim N
On Error GoTo cmdokError
If currentcommand = "Add" Then
rs.AddNew
For i = 0 To 15
rs.Fields(i) = txtb(i)
Next i
N = MsgBox("Added", vbOKOnly, "Add")
rs.Update

End If
cmdokEnd:
cmdokError:
rs.CancelUpdate

please help me as usual.
Thank you in advance.
Feb 5 '08 #1
Share this Question
Share on Google+
2 Replies


debasisdas
Expert 5K+
P: 8,127
Try to use this sample format

Expand|Select|Wrap|Line Numbers
  1. dim con as new adodb.connection
  2. con.begintrans
  3. con.execute "your sql statment"
  4. con.committrans
  5.  
Feb 5 '08 #2

lotus18
100+
P: 866

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. Private Sub mnuconp_Click()
  4. Dim N
  5.  On Error GoTo cmdokError
  6. If currentcommand = "Add" Then
  7. rs.AddNew
  8. For i = 0 To 15
  9. rs.Fields(i) = txtb(i)
  10. Next i
  11. N = MsgBox("Added", vbOKOnly, "Add")
  12. rs.Update
  13.  
  14. End If
  15. cmdokEnd: <------------What's this?
  16. cmdokError:
  17. rs.CancelUpdate
  18.  
So what's the problem?

Rey Sean
Feb 5 '08 #3

Post your reply

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