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

problem somewhere i cannot find

P: 9
im new to vb, still learning how to handel stuff....
i have this run-time error '91' that says that refers to .Addnew

this is my coding

Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2. Private Sub Form2_Load()
  3.     With Adodc1
  4.       .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
  5.             App.Path & "\database3.mdb;Persist Security Info=False"
  6.         .RecordSource = "select * from Entry order by Name, Contact"
  7.     End With
  8.     Set MSHFlexGrid1.DataSource = Adodc1
  9.     MSHFlexGrid1.FormatString = "Name    |    Contact Number |    Table"
  10.  
  11.  
  12.  
  13. End Sub
  14.  
  15. Private Sub cmdAddEntry_Click()
  16.     With Adodc1.Recordset
  17.         .AddNew
  18.         !Name = Text1
  19.         !Contact = Text2
  20.         !Table = Text3
  21.         .Update
  22.         .Requery
  23.     End With
  24.     Adodc1.Refresh
  25.     Set MSHFlexGrid1.DataSource = Adodc1
  26.     MSHFlexGrid1.FormatString = "Name    |    Contact Number |    Table"
  27.     Text1 = ""
  28.     Text2 = ""
  29.     Text3 = ""
  30.     Text1.SetFocus
  31.  
  32. End Sub
  33.  
  34. Private Sub cmdRemoveEntry_Click()
  35.     With Adodc1.Recordset
  36.         .Move (MSHFlexGrid1.Row - 1)
  37.         .Delete
  38.         .Requery
  39.     End With
  40.     Adodc1.Refresh
  41.     Set MSHFlexGrid1.DataSource = Adodc1
  42.     Text1.SetFocus
  43. End Sub
  44.  
  45. Private Sub Text1_Change()
  46.     If Text1.Text <> "" And Text2.Text <> "" And Text3.Text <> "" Then
  47.         cmdAddEntry.Enabled = True
  48.     Else
  49.         cmdAddEntry.Enabled = False
  50.     End If
  51.  
  52. End Sub
  53.  
  54. Private Sub Text2_Change()
  55.     Call Text1_Change
  56. End Sub
  57.  
  58. Private Sub Text3_Change()
  59.     Call Text1_Change
  60. End Sub
  61.  
  62. Private Sub Text3_KeyPress(KeyAscii As Integer)
  63.     Dim TrackKey As String
  64.     TrackKey = Chr(KeyAscii)
  65.     If (Not IsNumeric(TrackKey) And Not (KeyAscii = vbKeyBack)) Then
  66.         KeyAscii = 0
  67.     End If
  68.  
  69. End Sub
Apr 25 '07 #1
Share this Question
Share on Google+
3 Replies


P: 9
hehe sorry. new here :P anyone can help?
Apr 25 '07 #2

Expert 5K+
P: 8,434
hehe sorry. new here :P anyone can help?
I've been puzzling over this one a bit, but have never used the ADO data control. I have seen error 91 before, but it was generally because I had defined an object variable of some sort and not Set it to anything. If this is a control on the form, I imagine that shouldn't be necessary.
Apr 25 '07 #3

P: 9
ic... arite... thnx allot :P!!!
Apr 30 '07 #4

Post your reply

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