I am using a form to add records to a table named "MASTER LIST". This forms pulls up existing records, allows the user to change certain fields, and then the user clicks an Add button. The Add button is suppose to create a new record based on the information on the form. Basically I am creating a new record based on the old record, but with certain fields updated. The Add button is driven by VBA code, see below, but it is not creating a new record.
Most fields are text, there is one field (Policy_Year) that is a number, and four fields at the end that are date fields. Can someone tell me if this code has an issue?
Thanks
Code:
Private Sub Add_Click() Dim db As DAO.Database Dim rs As DAO.Recordset Dim strSQL As String On Error Resume Next Set db = CurrentDb Set rs = db.OpenRecordset(strSQL, dbOpenDynaset) CurrentDb.Execute "INSERT INTO [MASTER LIST] (" _ & "(Policy_Number," _ & "(Title," _ & "(Policy_Year," _ & "(Schedule," _ & "(Last_MPRM_ReviewDate," _ & "(Next_MPRM_ReviewDate," _ & "(Last_FEP_ReviewDate," _ & "(Next_FEP_ReviewDate," _ & "(Comments," _ & "(FEP_PolicyStatement," _ & "(Policy_HistoryChanges," _ & "(Orig_BlueWeb_PubDate," _ & "(Last_BlueWeb_PubDate," _ & "(Orig_FEPBlueOrg_PubDate," _ & "(Last_FEPBlueOrg_PubDate," _ & "(Keywords) VALUES " _ & "('" & Policy_Number.Value & "','" & Title.Value & "'," & Policy_Year.Value & ",'" & Schedule.Value & "','" & Last_MPRM_ReviewDate.Value & "','" & Next_MPRM_ReviewDate.Value & "','" & Last_FEP_ReviewDate.Value & "','" & Next_FEP_ReviewDate.Value & "','" & Comments.Value & "','" & FEP_PolicyStatement.Value & "','" & Policy_HistoryChanges.Value & "',#" & Format(Orig_BlueWeb_PubDate.Value, "mm/dd/yyyy") & "#,#" & Format(Last_BlueWeb_PubDate.Value, "mm/dd/yyyy") & "#,#" & Format(Orig_FEPBlueOrg_PubDate.Value, "mm/dd/yyyy") & "#,#" & Format(Last_FEPBlueOrg_PubDate.Value, "mm/dd/yyyy") & "#,'" & Keywords.Value & "');" rs.Close db.Close DoCmd.Close End Sub
Thanks
Comment