Saving New Records

Posted on 2000-02-29
Last Modified: 2010-05-02
I am working on a project, and the following code is supposed to save a new record. Instead it deletes and replaces the first record then adds a new record to EOF. Please help as my job is on the line(no joke), and as a newcomer this problem is driving me bonkers.

Code Begins:

Private Sub cmd_Save_Click()
Dim rs As Recordset
Set rs = Data1.Recordset

Data1.ReadOnly = False

strTypeOfInquiry = cmboTypeOfInquiry.Text
strStatus2 = cmboStatus.Text
T_TimeInteracting = Input_TimeSpentInteraction.Text
Dte_DateEntered = txt_DateEntered.Text
Dte_DateInteraction = txt_DateInteraction.Text
strNotes = txtNotes.Text
strAuthor = cmbo_Author.Text
num_ClientInteractions  = rs.RecordCount


With Data1.Recordset

            !Number_Client = strBBINumber
            If num_ClientInteractions  > 0 Then
                  !Client_Interactions = num_ClientInteractions + 1
                  !Client_Interactions = 1
            End IF
            !TypeOfInquiry = strTypeOfInquiry
            !Status = strStatus2
            !Date_Interaction = Dte_DateInteraction
            !DateEntered = Dte_DateEntered
            !Note = strNotes
            !InteractionAuthor = strAuthor
            !TimeSpentOnInteraction = T_TimeInteracting

            ClientInteraction.cmdSaveAndExit.Enabled = False

        End With

    End If

End Sub

CODE ENDS. Please help. Thank you.
Question by:dingo11
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
LVL 28

Accepted Solution

AzraSound earned 25 total points
ID: 2575277
The code I've always used for adding a record is as follows:

Data1.Recordset.Fields("fieldName") = SomeText.Text
Data1.Recordset.Fields("field2Name") = MoreText.Text



Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question