Drop a Button on your form and follow the Button Wizard. Look through the options available under Record Operations in the wizard.
You first CREATE (or move to) a new record, enter the details for that record, then SAVE. That's the sequence.
I have created a form which adds row of data (record) to a table. I am able to test the form but the problem now is that when I try to go to Design View, it gives an error:
------------------------------------------
ODBC --call failed
Cannot Insert the value NULL into the column. Column does not allow nulls. INSERT fails. The statement has been terminated.
------------------------------------------
When this error starts to appear, I am unable to view the form in design view or save it. But I am able to make entries to the table.
I am using this VBA code for the 'Add Record' button:
----------------------------------------------------------
Private Sub Add_Record_Click()
Dim strSQL As String
strSQL = "INSERT INTO dbo_VESSEL (VESSEL_NAME, VESSEL_CD,VOYAGE_NUM, LINE_CD, PORT_CD,DEPART_ACTUAL_DT,DIVISION_CD ) VALUES ('" & Me!VESSEL_NAME & "', '" & Me!VESSEL_CD & "','" & Me!VOYAGE_NUM & "', '" & Me!Text41 & "', '" & Me!PORT_CD & "', '" & Me!DEPART_ACTUAL_DT & "', '" & Me!Text45 & "');"
DoCmd.RunSQL strSQL
End Sub
------------------------------------------------------------
I have attached the screenshot of the error.
Many thanks for your help !