I would like the user to be able to click on a "New Record" button 
and have it put a new record in the table with a few predefined 
fields including the important one called "Sequence" which is a 
simple incremental integer. The table is called "Donations". Here's 
part of my code:

Private Sub cmdAddRecord_Click()
On Error GoTo Err_cmdAddRecord_Click
    Dim nNextRec As Integer
    DoCmd.GoToRecord , , acNewRec
    nNextRec = ListBrowser.ListCount + 1
    lblRow.Caption = Str(nNextRec)
    
    ' Here's the missing part. How do I assign values to
    ' a few of the fields/columns in the new record including
    ' the Sequence field and then how do I ensure that the 
    ' entire record is saved to the table before I go to
    ' the next step and call the main editing form just below.
    ' I'm not even sure how to do the basic assignments.
    ' Is it dome with Form!ListBrowser.fieldname = value or
    ' do I reference the main table somehow? Donations.Sequence
    ' doesn't work. I know this is basic stuff but I'm stuck.
    
    Call cmdEditDonations_Click  ' Detailed data entry form

Exit_cmdAddRecord_Click:
    Exit Sub
Err_cmdAddRecord_Click:
   MsgBox Err.Description
   Resume Exit_cmdAddRecord_Click
End Sub

Reply via email to