Hi,
I am trying to import a text file using my own Impoort Specification the DoCMD transfertext works but it gives me to many blank rows because the way the report was created. I would like access to get the file and appy the code below and so that all I get is rows where ":" is listed and import create the file. I have no training in programing I learn as I go and the code below I have from an old excel file which I think will work. I thought I will be able to do
DoCMD.TransferText, acimport, ???????? (this area where I would put save specification but how do I tell it to do code below), "TBl_Name", "H:\FileName"
Any help will be greatly appreciated
Dim TextLine1
FileN1 = FreeFile
FileN2 = FileN1 + 1
Open THISFILE For Input As #FileN1 'Open file.
Open "Insfile.txt" For Output As #FileN2 'Open file for Output
Do While Not EOF(FileN1) 'Loop unit end of file.
Line Input #FileN1, TextLine1 'Read line into variable.
CK1$ = Mid(TextLine1, 16, 1)
If CK1$ = ":" Then
Print #FileN2, TextLine1; Spc(1); TextLine2
End If
Loop
Close #FileN1 'Close File
Close #FileN2 'Close File
I am trying to import a text file using my own Impoort Specification the DoCMD transfertext works but it gives me to many blank rows because the way the report was created. I would like access to get the file and appy the code below and so that all I get is rows where ":" is listed and import create the file. I have no training in programing I learn as I go and the code below I have from an old excel file which I think will work. I thought I will be able to do
DoCMD.TransferText, acimport, ???????? (this area where I would put save specification but how do I tell it to do code below), "TBl_Name", "H:\FileName"
Any help will be greatly appreciated
Dim TextLine1
FileN1 = FreeFile
FileN2 = FileN1 + 1
Open THISFILE For Input As #FileN1 'Open file.
Open "Insfile.txt" For Output As #FileN2 'Open file for Output
Do While Not EOF(FileN1) 'Loop unit end of file.
Line Input #FileN1, TextLine1 'Read line into variable.
CK1$ = Mid(TextLine1, 16, 1)
If CK1$ = ":" Then
Print #FileN2, TextLine1; Spc(1); TextLine2
End If
Loop
Close #FileN1 'Close File
Close #FileN2 'Close File