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
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
Comment