problem somewhere i cannot find

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dreamonzzz
    New Member
    • Apr 2007
    • 9

    problem somewhere i cannot find

    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

    Code:
    Option Explicit
    Private Sub Form2_Load()
        With Adodc1
          .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
                App.Path & "\database3.mdb;Persist Security Info=False"
            .RecordSource = "select * from Entry order by Name, Contact"
        End With
        Set MSHFlexGrid1.DataSource = Adodc1
        MSHFlexGrid1.FormatString = "Name    |    Contact Number |    Table"
    
    
        
    End Sub
    
    Private Sub cmdAddEntry_Click()
        With Adodc1.Recordset
            .AddNew
            !Name = Text1
            !Contact = Text2
            !Table = Text3
            .Update
            .Requery
        End With
        Adodc1.Refresh
        Set MSHFlexGrid1.DataSource = Adodc1
        MSHFlexGrid1.FormatString = "Name    |    Contact Number |    Table"
        Text1 = ""
        Text2 = ""
        Text3 = ""
        Text1.SetFocus
        
    End Sub
    
    Private Sub cmdRemoveEntry_Click()
        With Adodc1.Recordset
            .Move (MSHFlexGrid1.Row - 1)
            .Delete
            .Requery
        End With
        Adodc1.Refresh
        Set MSHFlexGrid1.DataSource = Adodc1
        Text1.SetFocus
    End Sub
    
    Private Sub Text1_Change()
        If Text1.Text <> "" And Text2.Text <> "" And Text3.Text <> "" Then
            cmdAddEntry.Enabled = True
        Else
            cmdAddEntry.Enabled = False
        End If
    
    End Sub
    
    Private Sub Text2_Change()
        Call Text1_Change
    End Sub
    
    Private Sub Text3_Change()
        Call Text1_Change
    End Sub
    
    Private Sub Text3_KeyPress(KeyAscii As Integer)
        Dim TrackKey As String
        TrackKey = Chr(KeyAscii)
        If (Not IsNumeric(TrackKey) And Not (KeyAscii = vbKeyBack)) Then
            KeyAscii = 0
        End If
    
    End Sub
    Last edited by Killer42; Apr 25 '07, 09:13 AM. Reason: Please use [CODE]...[/CODE] tags around your code.
  • dreamonzzz
    New Member
    • Apr 2007
    • 9

    #2
    hehe sorry. new here :P anyone can help?

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Originally posted by dreamonzzz
      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.

      Comment

      • dreamonzzz
        New Member
        • Apr 2007
        • 9

        #4
        ic... arite... thnx allot :P!!!

        Comment

        Working...