Hi guys...
I'm stucked on another bug issue(of course big for me!!!!) the problem is:
For some reasons, I need to import in the same project three tables, one I'm been able to import thanks to your suggestion using a mix of vba and sql, the Second I've been able quite easily to import into access(it was an excell doc).
the third one is getting me quit upset:
I've transformed the file from excel to csv format since the excel importation seems to fail;
I've just arranged to change the syntax of the first importing code to import the second file in my access table.
But it seems to create conflict between the sub import 1 and the sub import 3... is it possible?????
this is the syntax of the second importation:
Code:
sub p()
Const G = "CREATE TABLE CPex (CD_MAD Text(40), SCHEMA Text(255));"
CurrentDb.Execute G
End Sub
Sub Icsv()
Dim LineData As String
Dim inj As Integer
inj = FreeFile
Open "C:\Users\path..." For Input As #inj
Do Until EOF(inj)
Line Input #inj, LineData
InsertRow "CPex", LineData
Loop
Close #inj
End Sub
Sub InsertRow2(ByVal LineData As String)
Const c_SQL As String = "INSERT INTO CPex (CD_MAD, SCHEMA) VALUES ('AA1', '2') ;"
Dim strQ As String
strQ = Replace(c_SQL, "AA1", Mid(LineData, 1, 3))
strQ = Replace(c_SQL, "2", Mid(LineData, 5, 120))
Debug.Print strQ: Stop
CurrentDb.Execute strQ
End Sub
the source file is like this:
AA1; C099923 D0326840
why it does't work??????