We are saving records in table using VB code, since "add button" is not working ,I tried to write code DoCmd.GoToRecord , , acNewRec to go to new record using same button but that is also not working.How to add new record to a single button which save data in table as well go to new record in form?
Please can anyone find solution for this problem.
Code used in our Project
Private Sub Save_Click()
If IsNull(DCNo) Or IsNull(Billing_Type) Or IsNull(Outward_Date) Or IsNull(Item_No) Or IsNull(Customer) Or IsNull(GRNNumber) Or IsNull(Ref_DC) Or IsNull(Sinter_Id) Or IsNull(Processed_Qty) Or IsNull(Accepted_Qty) Or IsNull(Rejected_Qty) Or IsNull(Inward_Rejection) Or IsNull(Un - Processed_Qty) Then
MsgBox "Please Fill Empty Fields ", , "Details required"
Else
MsgBox "Do you want to submit the details of Outward Register Form"
CurrentDb.Execute "INSERT INTO Outward([DCNO],[Billing_Type],[Outward_Date],[Item_No],[Customer],[GRNNumber],[Ref_DC],[Sinter_Id],[Processed_Qty],[Accepted_Qty],[Rejected_Qty],[Inward_Rejection],[Un-Processed_Qty],[Remarks])" & _
"VALUES('" & Me.DCNo & "','" & Me.Billing_Type & "','" & Me.Outward_Date & "','" & Me.Item_No & "','" & Me.Customer & "','" & _
Me.GRNNumber & "','" & Me.Ref_DC & "','" & Me.Sinter_Id & "','" & Me.Processed_Qty & "','" & Me.Accepted_Qty & "','" & Me.Rejected_Qty & "','" & Me.Inward_Rejection & "','" & Me.Un_Processed_Qty & "','" & Me.Remarks & "')"
End If
Dim strMsg As String
strMsg = "Do you want to enter a new record?"
If MsgBox(strMsg, vbYes Or vbQuestion) = vbYes Then
DoCmd.GoToRecord , , acNewRec
End If
End Sub