<Previous Lesson><<Home>> < Next Lesson>
' Move to the first recorddata_navigator.RecordSet.MoveFirst' Move to the last recorddata_navigator.RecordSet.MoveLast' Move to the next recorddata_navigator.RecordSet.MoveNext' Move to the first recorddata_navigator.RecordSet.Previous
data_navigator.RecordSet.AddNew ' Adds a new record*note: data_navigator is the name of data control
data_navigator.RecordSet.Update ' Updates and saves the new record
data_navigator.RecordSet.Delete ' Deletes a current record
In the following example, you shall insert four commands and label them as First Record, Next Record, Previous Record and Last Record . They will be used to navigator around the database without using the data control. You still need to retain the same data control (from example in lesson 19) but set the property Visible to no so that users will not see the data control but use the button to browse through the database instead. Now, double-click on the command button and key in the codes according to the labels.
Private Sub Command2_Click()
dtaBooks.Recordset.MoveFirst
End Sub
Private Sub Command1_Click()
dtaBooks.Recordset.MoveNext
End Sub
Private Sub Command3_Click()
dtaBooks.Recordset.MovePrevious
End Sub
Private Sub Command4_Click()
dtaBooks.Recordset.MoveLast
End Sub
dtaBooks.Recordset.MoveFirst
End Sub
Private Sub Command1_Click()
dtaBooks.Recordset.MoveNext
End Sub
Private Sub Command3_Click()
dtaBooks.Recordset.MovePrevious
End Sub
Private Sub Command4_Click()
dtaBooks.Recordset.MoveLast
End Sub
Run the application and you shall obtain the interface below and you will be
able to browse the database using the four command buttons.
0 comments :
Post a Comment