All solved guy's once again, thank you so so much, i got rid of blanks by setting another recordset to delete blank records, this all now does it as below, Added a new form to separate pasted records Pasted and added a field called Pasted Yes/No and set the criteria to Yes
Added !pasted in the recordset, deleted any blanks using rsDel and all perfect
Code:
Dim stAppName As String, myURL As String, OpenChrome As String, myApp As String, stPathName As StringDim myCust As String, cAdd1 As String, cAdd2 As String, cTown As String, cPC As String
Dim c1 As String, c2 As String, c3 As String, c4 As String, c5 As String, c8 As String
Dim xlRow As Long, LastRow As Long, ColCount As Long
Dim myRow As Integer, i As Integer, c6 As Integer, c7 As Integer, DelQty As Integer
Dim FindRow As Range
Dim xl As Excel.Application
Dim xlsht As Excel.Worksheet
Dim xlWrkBk As Excel.Workbook
Dim rsDel As DAO.Recordset
srcPath = "T:\DMT Ltd\XL Files\"
srcFile = "New Items.xlsx"
'IMPORTANT TO KNOW, 'AN EXTAERNAL CLOUD BASED FILE OPENS BEFORE THIS PROCEDURE TO COPY CELLS FROM
myCust = Forms!frmMainMenu!frmIndex1!cboCustomer
cAdd1 = DLookup("Add1", "tblCustomers", "[Name] Like ""*" & myCust & "*""")
cAdd2 = DLookup("Add2", "tblCustomers", "[Name] Like ""*" & myCust & "*""")
cTown = DLookup("Town", "tblCustomers", "[Name] Like ""*" & myCust & "*""")
cPC = DLookup("Postcode", "tblCustomers", "[Name] Like ""*" & myCust & "*""")
Set xl = CreateObject("Excel.Application")
Set xlWrkBk = GetObject(srcPath & srcFile)
Set xlsht = xlWrkBk.Worksheets(1)
xl.Visible = False
Set rs = CurrentDb.OpenRecordset("SELECT * FROM tblEdit WHERE 1 = 0") 'you don't use these values so load an empty recordset on the table
'Set rs = CurrentDb.OpenRecordset("SELECT * FROM tblEdit")
LastRow = xlsht.UsedRange.Rows.Count
' ColCount = xlsht.UsedRange.Columns.Count
myRow = "6"
For i = myRow To LastRow
c1 = xlsht.Cells(i, 2).Value ' Del TO
c2 = xlsht.Cells(i, 3).Value 'Town
c3 = xlsht.Cells(i, 4).Value 'PostCode
c4 = xlsht.Cells(i, 5).Value 'ItemNo
c5 = xlsht.Cells(i, 6).Value 'SL
c6 = xlsht.Cells(i, 7).Value 'Boxes
c7 = xlsht.Cells(i, 8).Value 'Rails
''Next i
''Set rs = CurrentDb.OpenRecordset("Select * From tblEdit") 'don't repeatedly open the same rs in a loop
With rs
.AddNew
!Customer = myCust
!CustAdd1 = cAdd1
!CustAdd2 = cAdd2
!CustTown = cTown
!CustPostCode = cPC
!ShipmentDate = Null
!PONumber = "PO-"
!SONumber = c5
!LiftType = "Item"
!LiftNo = c4
!TotalBox = c6
!TotalRail = c7
!DelTo = DLookup("Name", "tblDealers", "[PostCode] = '" & c3 & "'")
!Town = DLookup("Town", "tblDealers", "[PostCode] = '" & c3 & "'")
!PostCode = c3
!Added = "New"
!Status = "Planning"
!DueDay = ""
!Source = "Acc"
!Pasted = True
.Update
''.Close
End With
Next i
rs.Close
xl.Quit
Set xl = Nothing
Set xlWrkBk = Nothing
Set xlsht = Nothing 'forgot this one. Such omissions are a byproduct of not indenting IMO
Set rsDel = CurrentDb.OpenRecordset("Select * From tblEdit WHERE DelTo Is Null")
DelQty = rsDel.RecordCount
With rsDel
Do Until rsDel.EOF
.Delete
rsDel.MoveNext
Loop
rsDel.Close
End With
Set rsDel = Nothing
Me.frmIndex1DS.Visible = False
Me.frmIndex1DSPaste.Visible = True
Me.frmIndex1DSPaste.Requery