Here's an idea, forget the Do While Not EOF(nFileNumber) and just try the following...
Do
Line Input #nFileHandle, strLine
debug.print strLine
rstImportContacts.AddNew
rstImportContacts![webCustID] =Val(GetColumnCommaDelimited(strLine, 2))
rstImportContacts![ConNameLast] =GetColumnCommaDelimited(strLine, 3)
rstImportContacts![ConNameCo] =GetColumnCommaDelimited(strLine, 4)
rstImportContacts.Update
nLineNumber = nLineNumber + 1
Loop Until strLine = ""
Duane
--- In AccessDevelopers@yahoogroups.com, "Patty Mapes" <[EMAIL PROTECTED]> wrote:
>
> It doesn't trip the error, just closes after the first record.
>
> bummer.
>
> Patricia Mapes
>
> Chancellor, Institute for Spiritual Development
>
> Streams Ministries International
>
> 603-927-4224
>
> www.streamsministries.com
>
>
>
> ________________________________
>
> From: AccessDevelopers@yahoogroups.com
> [mailto:[EMAIL PROTECTED] On Behalf Of Duane Hennessy
> Sent: Monday, January 09, 2006 8:23 PM
> To: AccessDevelopers@yahoogroups.com
> Subject: [AccessDevelopers] Re: flawed code
>
>
>
> Are you receiving any errors? Put some error capturing code into it like
> the following blue code below...
> When you say that it does not move past the first line of the text file
> do you mean:
>
> 1. That it is actually reading in the first string and putting the
> data into the table?
> 2. That it is reading in the first string and not putting it into
> the table?
> 3. That the table is only showing one record at the end of the
> routine?
>
> Try the code below and let me know your results. Just curious, why don't
> you use the Docmd.TransferText method to import your data file?
>
> Sub ImportGLI(dbCurrent As Database, strFilename As String)
> on error goto err_:
> Dim rst As DAO.Recordset
> Dim rstImportContacts As DAO.Recordset
> Dim nFileHandle As Long
> Dim strLine As String
> Dim nLineNumber As Long
> Dim nImportNum As Long
> Dim rstCurrentContacts As DAO.Recordset
>
> ''''First Import/Update Primary Info'''''
>
> Set rstImportContacts = dbCurrent.OpenRecordset("select * from
> [MainImport]")
> nFileHandle = FreeFile
> nLineNumber = 1
> Open strFilename For Input As #nFileHandle
> Do While Not EOF(nFileHandle)
> Line Input #nFileHandle, strLine
> debug.print strLine
> rstImportContacts.AddNew
> rstImportContacts![webCustID] =Val(GetColumnCommaDelimited(strLine, 2))
> rstImportContacts![ConNameLast] =GetColumnCommaDelimited(strLine, 3)
> rstImportContacts![ConNameCo] =GetColumnCommaDelimited(strLine, 4)
> rstImportContacts.Update
> nLineNumber = nLineNumber + 1
> Loop
>
> exit_routine:
> Close #nFileHandle
> exit sub
> err_:
> msgbox err.number & vbcrlf & err.description
> goto exit_routine
> End Sub
>
> regards,
>
> Duane Hennessy.
> Bandicoot Software
> Tropical Queensland, Australia
> (ABN: 33 682 969 957)
> Want Increased Productivity?
> http://www.bandicootsoftware.com.au
>
>
> --- In AccessDevelopers@yahoogroups.com, "Patty Mapes" [EMAIL PROTECTED]
> wrote:
> >
> > I have this code that I used some years ago for importing comma
> > delimited files into an mdb. It is not moving past the first line of
> > the text file. If there is anyone who can see where the problem is, it
> > would be very much appreciated.
> >
> > Thanks,
> >
> > Sub ImportGLI(dbCurrent As Database, strFilename As String)
> > Dim rst As DAO.Recordset
> > Dim rstImportContacts As DAO.Recordset
> > Dim nFileHandle As Long
> > Dim strLine As String
> > Dim nLineNumber As Long
> > Dim nImportNum As Long
> > Dim rstCurrentContacts As DAO.Recordset
> >
> > ''''First Import/Update Primary Info'''''
> > Set rstImportContacts = dbCurrent.OpenRecordset("select * from
> > [MainImport]")
> >
> > nFileHandle = FreeFile
> > nLineNumber = 1
> > Open strFilename For Input As #nFileHandle
> > Do While Not EOF(nFileHandle)
> > Line Input #nFileHandle, strLine
> >
> >
> > rstImportContacts.AddNew
> > rstImportContacts![webCustID] =
> > Val(GetColumnCommaDelimited(strLine, 2))
> > rstImportContacts![ConNameLast] =
> > GetColumnCommaDelimited(strLine, 3)
> > rstImportContacts![ConNameCo] =
> > GetColumnCommaDelimited(strLine, 4)
> > rstImportContacts.Update
> >
> >
> > nLineNumber = nLineNumber + 1
> > Loop
> >
> > End Sub
> >
> > Patricia Mapes
> >
> > Chancellor, Institute for Spiritual Development
> >
> > Streams Ministries International
> >
> > 603-927-4224
> >
> > www.streamsministries.com
> >
>
>
>
>
>
> Please zip all files prior to uploading to Files section.
>
>
>
> ________________________________
>
> YAHOO! GROUPS LINKS
>
>
>
> * Visit your group "AccessDevelopers
> <http://groups.yahoo.com/group/AccessDevelopers> " on the web.
>
> * To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]
> >
>
> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/> .
>
>
> ________________________________
>
Please zip all files prior to uploading to Files section.
YAHOO! GROUPS LINKS
- Visit your group "AccessDevelopers" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.