Article ID: 189851
Article Last Modified on 7/15/2004
Control Type Control Name Caption
------------ ------------ -------
Data datDataCtl
Text Box txtCategory
Command Button cmdAddNew Add
Command Button cmdMoveVeryLast Move Very Last
Option Explicit
Private Sub cmdAddNew_Click()
'Uncomment this block to avoid 3426 error message
' Check to see you are on NULL Pointer
'If datDataCtl.Recordset.EOF Or datDataCtl.Recordset.BOF Then
'Dim strBuffer As String
' Save what was typed into the text box into memory
'strBuffer = txtCategory.Text
' Restore text box value to the original record contents
' in this case, that is NULL
'datDataCtl.UpdateControls
' Add a new blank record
'datDataCtl.Recordset.AddNew
' Restore what has been typed from memory to text box
'txtCategory.Text = strBuffer
' Save the current record we are on and Add a new blank
' record
'datDataCtl.Recordset.AddNew
'End If
' be sure to comment below line when uncommenting above block of
' code to avoid an additional record added to the recordset.
datDataCtl.Recordset.AddNew
End Sub
Private Sub cmdMoveVeryLast_Click()
If Not (datDataCtl.Recordset.BOF Or datDataCtl.Recordset.EOF) Then
datDataCtl.Recordset.MoveLast
datDataCtl.Recordset.MoveNext
End If
End Sub
Private Sub Form_Load()
With datDataCtl
.DatabaseName = App.Path & "\NWIND.MDB"
.RecordSource = "Categories"
End With
txtCategory.DataField = "CategoryName"
End Sub
Additional query words: kbVBp kbVBp500 kbVBp600 kbdss kbDSupport kbVBp400 kbDatabase kbDAO
Keywords: kbprb KB189851