Code:
Dim conn As ADODB.Connection
Dim Rs As ADODB.Recordset
Private Sub cmdAdd_Click()
If Len(Trim(Text1.Text)) > 0 Then
With Rs
.AddNew
DataGrid1.DataField = "Field1"
DataGrid1.DataField = "Field1"
.Update
DataGrid1.Refresh
End With
DataGrid1.Field(1).DataField Text1.Text
DataGrid1.Field(2).DataField Text2.Text
DataGrid1.Field(3).DataField Text3.Text
DataGrid1.Field(4).DataField Text4.Text
DataGrid1.Field(5).DataField Text5.Text
DataGrid1.Text = ""
DataGrid1.Text = ""
DataGrid1.Text = ""
DataGrid1.Text = ""
DataGrid1.Text = ""
Else
MsgBox "Please Insert Date"
End If
End Sub
Private Sub Form_Load()
Set conn = New ADODB.Connection
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.ConnectionString = "Data Source=" & App.Path & "\db1.mdb"
conn.Open
Set Rs = New ADODB.Recordset
Rs.Open "SELECT * from Table1", conn, adOpenStatic, adLockOptimistic
Do While Not Rs.EOF = True
Text1.DataField = "Field1"
Text2.DataField = "Field2"
Text3.DataField = "Field3"
Text4.DataField = "Field4"
Text5.DataField = "Field5"
Rs.MoveNext
Loop
End Sub
WHERE I AM WRONG

Last edited by shabbir; 28Jul2010 at 13:53.. Reason: Code blocks