Private Sub Form_Load()
Set db = DBEngine.OpenDatabase(App.Path & "\db1.mdb", True, False, ";Pwd =" & "000")
Set rs = db.OpenRecordset("soft", 2)
rs.MoveLast
rs.MoveFirst
Label4.BackColor = vbBlack
Label4.ForeColor = vbWhite
If rs.RecordCount > 0 Then ViewRecord
End Sub
Private Sub ViewRecord()
Text1.Text = rs.Fields!ID
Text2.Text = rs.Fields!Name
Text3.Text = rs.Fields!Phone
Label4.Caption = (rs.AbsolutePosition + 1) & " / " & (rs.RecordCount)
End Sub
Private Sub Command3_Click()
If rs.AbsolutePosition > 0 Then
rs.MovePrevious
ViewRecord
End If
End Sub
Private Sub Command4_Click()
rs.MoveFirst
If rs.RecordCount > 0 Then ViewRecord
End Sub
Private Sub Command5_Click()
If (rs.AbsolutePosition + 1) < rs.RecordCount Then
rs.MoveNext
ViewRecord
End If
End Sub
Private Sub Command6_Click()
rs.MoveLast
If rs.RecordCount > 0 Then ViewRecord
End Sub
Private Sub Command1_Click()
Set db = OpenDatabase(App.Path & "\db1.mdb", 2)
Set rs = db.OpenRecordset("SELECT * FROM [soft] ")
aaa = MsgBox("هل تريد بتاكيد حفظ البيانات", vbExclamation + vbYesNo + vbMsgBoxRtlReading)
If aaa = vbYes Then
rs.AddNew
If Not Trim(Text1.Text) = "" Then rs("ID").Value = Val(Trim(Text1.Text))
If Not Trim(Text2.Text) = "" Then rs("Name").Value = Trim(Text2.Text)
If Not Trim(Text3.Text) = "" Then rs("Phone").Value = Trim(Text3.Text)
rs.Update
MsgBox "تم حفط البيانات ", vbInformation + vbMsgBoxRtlReading
Text1 = ""
Text2 = ""
Text3 = ""
End If
End Sub