Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.
Private Sub Generate_Click() Dim i As Long Dim sql As String Dim strInvoice As String Dim strSOR As String Dim datDate As Date On Error GoTo err strInvoice = Me.txtInvoiceNumber strSOR = Me.txtSorNumber datDate = Me.txtDate For i = Me.txtrange1 To Me.txtRange2 sql = "Insert Into computer(Serial,[Invoice Number],[SOR Number],[Invoice date]) VALUES (" sql = sql & i & "," sql = sql & Chr(34) & strInvoice & Chr(34) & "," sql = sql & Chr(34) & strSOR & Chr(34) & "," sql = sql & "#" & datDate & "#" & ")" DoCmd.SetWarnings False DoCmd.RunSQL sql Next i DoCmd.GoToRecord , , acNext DoCmd.GoToRecord , , acPrevious err: Me.txtInvoiceNumber = Null Me.txtSorNumber = Null Me.txtDate = Null Me.txtrange1 = Null Me.txtRange2 = Null MsgBox "Batch Operation Completed.", vbInformation + vbOKOnly, "Batch Addition" End Sub