Hi,
I have a 6 iCal files as a TEXT files with simply 1 field in each (see bottom)
I import using transfer text as below.
6 different text files appended to one table, hence the looping
On exactly the SAME text files, sometimes it works fine but mostly a few missed lines.
Each Text file is about 200 lines long. short text.
If I add a msgbox as below, between each import file it works fine so I guess enough of a delay to allow it to work. tried a variety of DoEvents dotted around but helps a little but not reliable, I think I need a loop.
However the ODD thing is the missing lines are usually random & in the middle of the text file so I can't open the table & delay loop to check to see the last line is e.g. "END:VCALENDAR" as it could well be but missing a few lines earlier in the file??
I will add a time delay but not really proper & would prefer to understand what is going on. The text files do not have the same number of lines or anything else I can easily check to be sure.
thanks i/a
Set SH = CurrentDb.OpenRecordset("StaffCalHeader")
If Not (SH.EOF And SH.BOF) Then
SH.MoveFirst
Do Until SH.EOF = True
strFilename = SH!DestinationFile
DoCmd.TransferText acImportFixed, "ImportGoogleiCalSpec", "GoogleCalendar", strFilename, False
DoEvents
MsgBox "Wait - delay"
SH.MoveNext
Loop
End If
MsgBox "Import complete"
text file
BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHODUBLISH
X-WR-CALNAME:Greg
X-WR-TIMEZONE:Europe/London
BEGIN:VEVENT
DTSTART;VALUE=DATE:20171026
DTEND;VALUE=DATE:20171029
DTSTAMP:20181105T173656Z
I have a 6 iCal files as a TEXT files with simply 1 field in each (see bottom)
I import using transfer text as below.
6 different text files appended to one table, hence the looping
On exactly the SAME text files, sometimes it works fine but mostly a few missed lines.
Each Text file is about 200 lines long. short text.
If I add a msgbox as below, between each import file it works fine so I guess enough of a delay to allow it to work. tried a variety of DoEvents dotted around but helps a little but not reliable, I think I need a loop.
However the ODD thing is the missing lines are usually random & in the middle of the text file so I can't open the table & delay loop to check to see the last line is e.g. "END:VCALENDAR" as it could well be but missing a few lines earlier in the file??
I will add a time delay but not really proper & would prefer to understand what is going on. The text files do not have the same number of lines or anything else I can easily check to be sure.
thanks i/a
Set SH = CurrentDb.OpenRecordset("StaffCalHeader")
If Not (SH.EOF And SH.BOF) Then
SH.MoveFirst
Do Until SH.EOF = True
strFilename = SH!DestinationFile
DoCmd.TransferText acImportFixed, "ImportGoogleiCalSpec", "GoogleCalendar", strFilename, False
DoEvents
MsgBox "Wait - delay"
SH.MoveNext
Loop
End If
MsgBox "Import complete"
text file
BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHODUBLISH
X-WR-CALNAME:Greg
X-WR-TIMEZONE:Europe/London
BEGIN:VEVENT
DTSTART;VALUE=DATE:20171026
DTEND;VALUE=DATE:20171029
DTSTAMP:20181105T173656Z