I run into an compilation error "Expected procedure, not variable" where i can not find the issue. Can someone help me with finding/pointing the issue? Setup is to get a file from a FTP place and then read it into a access database. Code is based on https://www.excel-easy.com/vba/examples/read-data-from-text-file.html The transfertext with a delimit design option is not possible because it somehow locks up. The file itself is small.
There is no reference added yet (like scripting or other libraries), in case that is important.
code below:
Public Function ImportCSVFile()
Dim strTextLine As String
Dim aryMyData() As String
Dim strSQL As String
Open "C:\Users\Electronica\Documents\3000.csv" For Input As #1
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
Debug.Print aryMyData
If aryMyData(0) = "" Then
strSQL = "INSERT INTO Tbl_Theo_Stock([Delivery Note], [Delivery Date], [Delivered QTY], [LABELNR], [SAP PO], [SAP POS], [OPEN QTY], [Wished Date], [Materialnr], [reference], [description], [vendor]) "
strSQL = strSQL & " VALUES(" & aryMyData(0) & ", " & aryMyData(1) & ", " & aryMyData(2) & ", " & aryMyData(3) & ", " & aryMyData(4) & ", " & aryMyData(5) & ", " & aryMyData(6) & ", #" & aryMyData(7) & "#, " & aryMyData(8) & ", " & aryMyData(9) & ", " & aryMyData(10) & ", " & aryMyData(11) & ", " & aryMyData() & ", " & aryMyData(12) & ");"
Else
End If
'Debug.Print strSQL
DoCmd.RunSQL strSQL
Loop
Close #1
Debug.Print "hello"
End Function