Private Sub Command107_Click()
'Added by Greg Martin 08042017
On Error GoTo Err_Command107_Click
Dim strTextLine As String
Dim aryMyData() As String
Dim strSQL As String
Dim directory As String
Dim FileName As String
Dim i As Integer
Dim i2 As Integer
Dim currtoint As String
Dim i3 As Integer
directory = "C:\CSVupload\"
FileName = "od.csv"
i = 1
Open directory & FileName For Input As #1
DoCmd.SetWarnings False 'TURN ERROR PROMPTS OFF
Do While Not EOF(1) ' Loop until end of file.
Line Input #1, strTextLine ' Read line into variable.
aryMyData = Split(strTextLine, ",") 'Split text into array by comma
If i <> 1 Then
i2 = Len(aryMyData(8))
currtoint = Right(aryMyData(8), i2 - 1)
i3 = Int(currtoint)
strSQL = "INSERT INTO Donations ([ID No], [Date of Donation], Amount, [Check #], [Deductable Amount], [Donation Type]) " _
& " VALUES(" & aryMyData(22) & ", #" & aryMyData(7) & "#, " & i3 & ", " & aryMyData(23) & ", " & i3 & ",'Online')"
DoCmd.RunSQL strSQL
End If
i = 2
Loop
Close #1
DoCmd.SetWarnings True
Exit_Command107_Click:
DoCmd.SetWarnings True
Exit Sub
Err_Command107_Click:
DoCmd.SetWarnings True
MsgBox Err.Description
Resume Exit_Command107_Click
End Sub