A database application can be created using data control in Visual Basic. The data control support some methods that are useful in manipulating the database, for example, to move the pointer to a certain location. The following are some of the commands:
data_navigator.RecordSet.MoveFirst ' Move to the first record data_navigator.RecordSet.MoveLast ' Move to the last record data_navigator.RecordSet.MoveNext ' Move to the next record data_navigator.RecordSet.Previous ' Move to the first record data_navigator.RecordSet.AddNew ' Adds a new record data_navigator.RecordSet.Update 'Saves new record data_navigator.RecordSet.Delete& ' Deletes a current record
*note: data_navigator is the name of data control
In the following example, you need to insert four commands and label them as First Record, Next Record, Previous Record and Last Record as well as name them as cmdFirst, cmdNext, cmdPrevious and cmdLast.You also need to insert the data control.They will be used to navigator around the database without using the data control.
Private Sub cmdFirst_Click()
Private Sub cmdNext_Click()
Private Sub cmdPrevious_Click()
Private Sub cmdLast_Click()