I'm having a problem with my add() function not inserting rows into my table. I deleted the contents of both the tables it checks so that all the data would be inserted. All the if statements are right, but for some reason it doesn't insert them or give an error message. Any suggestions? Thanks.

VB Code:
  1. '*ADD()************************************************************************
  2. 'NAME: add()
  3. 'DESC: Adds items that are not currently in the MAIN or ALTER table
  4. Private Sub add()
  5.     On Error Resume Next
  6.    
  7.     Set newConnection = New ADODB.connection
  8.     newConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
  9.         "Data Source= C:\Documents and Settings\P6B0438\My Documents\Programs\Visual Basic\DB\Test.mdb"
  10.     newConnection.Open
  11.     Set newRecordSet = New ADODB.recordSet
  12.     newRecordSet.Open "Untitled", newConnection, adOpenKeyset, adLockPessimistic, adCmdTable
  13.    
  14.     Set connection = New ADODB.connection
  15.     connection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
  16.         "Data Source= C:\Documents and Settings\P6B0438\My Documents\Programs\Visual Basic\DB\cycleCount.mdb"
  17.     connection.Open
  18.     Set recordSet = New ADODB.recordSet
  19.     recordSet.Open "MAIN", connection, adOpenKeyset, adLockPessimistic, adCmdTable
  20.    
  21.     Dim sql As String
  22.    
  23.     newRecordSet.MoveFirst
  24.     Dim num As Integer
  25.        
  26.     Do Until newRecordSet.EOF
  27.         If (inMain(newRecordSet.Fields("PICKSL"), newRecordSet.Fields("SLOT"), newRecordSet.Fields("RES"), newRecordSet.Fields("PROD"), newRecordSet.Fields("PACK"), newRecordSet.Fields("MANU ID"), newRecordSet.Fields("HITIX"), newRecordSet.Fields("PALLET ID"), newRecordSet.Fields("DFP")) = False) Then
  28. MsgBox ("It's not in the MAIN table")
  29.             If (inAlter(newRecordSet.Fields("PICKSL"), newRecordSet.Fields("SLOT"), newRecordSet.Fields("RES"), newRecordSet.Fields("PROD"), newRecordSet.Fields("PACK"), newRecordSet.Fields("MANU ID"), newRecordSet.Fields("HITIX"), newRecordSet.Fields("PALLET ID"), newRecordSet.Fields("DFP")) = False) Then
  30. MsgBox ("It's not in the ALTER table")
  31.                 sql = "Insert into [MAIN] (PICKSL,SLOT,RES,PROD,[DESC],PACK," & _
  32.                     "[MANU ID],HITIX, [PALLET ID],[PALLET QTY],DFP) VALUES ('" & _
  33.                     recordSet.Fields("PICKSL") & "','" & recordSet.Fields("SLOT") & _
  34.                     "','" & recordSet.Fields("RES") & "'," & recordSet.Fields("PROD") & _
  35.                     ",'" & recordSet.Fields("DESC") & "','" & recordSet.Fields("PACK") & _
  36.                     "','" & recordSet.Fields("MANU ID") & "','" & recordSet.Fields("HITIX") & _
  37.                     "','" & recordSet.Fields("PALLET ID") & "'," & recordSet.Fields("PALLET QTY") & _
  38.                     ",'" & recordSet.Fields("DFP") & "')"
  39. Debug.Print sql
  40.                 connection.Execute sql
  41. Debug.Print sql
  42. MsgBox ("Should have inserted")
  43.             End If
  44.         End If
  45.        
  46.         newRecordSet.MoveNext
  47.     Loop
  48. End Sub
  49. '*ENDOF*ADD()******************************************************************