[AccessD] Load from test AGAIN

Mark A Matte markamatte at hotmail.com
Wed Oct 18 15:12:59 CDT 2006


How about!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  Your were trying to name wiht 
the .txt

Worked for me...hope it works for you.

Mark A. Matte

Public Sub ImpFromText()
Dim strTemp As String
Dim path As String

path = "c:\temp\test\Form*.*"
strTemp = Dir(path)
Do While strTemp <> ""
Dim test
test = Mid(strTemp, InStr(1, strTemp, "_", vbTextCompare) + 1)
Dim test2
test2 = Left(test, InStr(1, test, ".", vbTextCompare) - 1)

    Application.LoadFromText acForm, test2, "C:\temp\test\" & strTemp
    strTemp = Dir
Loop

End Sub


>From: "Martin Reid" <mwp.reid at qub.ac.uk>
>Reply-To: Access Developers discussion and problem 
>solving<accessd at databaseadvisors.com>
>To: "Access Developers discussion and problem 
>solving"<accessd at databaseadvisors.com>
>Subject: Re: [AccessD] Load from test AGAIN
>Date: Wed, 18 Oct 2006 21:04:10 +0100
>
>Mark/John
>
>Yeah I was wondering that as I was typing and I cant see why. I check each 
>time strtemp always has the correct value.
>
>the underscore was me (<: I have removed it and removed all spaces. When I 
>trace the calls the file name is OK other than back to the first issue of 
>the file extension .txt on the end.
>
>But the name is OK now in the error message BUT it includes the file 
>extension. I am thinking back to martys post re stripping the txt 
>extension. I juts cant think of anything else that would cause this.
>
>Hes the error log from inside Access
>
>Microsoft Office Access encountered an error while importing the object 
>'YourFormName'.
>Error encountered at line 781.
>Expected: 'End'.  Found: =.
>
>Means nothing to me but there you go! But could this be an internal Access 
>error????
>
>
>Martin
>
>
>
>
>Martin WP Reid
>Training and Assessment Unit
>Riddle Hall
>Belfast
>
>tel: 02890 974477
>
>
>________________________________
>
>From: accessd-bounces at databaseadvisors.com on behalf of Mark A Matte
>Sent: Wed 18/10/2006 20:46
>To: accessd at databaseadvisors.com
>Subject: Re: [AccessD] Load from test AGAIN
>
>
>
>Martin,
>
>I'm stabbing at this...but I've done a lot automation and looping around
>importing files...granted I haven't ever used loadfromtext...but why is the
>object listed in your error different than the value of strTemp:
>strTemp="Form_Customer Details.txt "
>ErrorObject="Customer Details.txt"
>
>Is it not being passed correctly?
>
>Mark A. Matte
>
>
> >From: "Martin Reid" <mwp.reid at qub.ac.uk>
> >Reply-To: Access Developers discussion and problem
> >solving<accessd at databaseadvisors.com>
> >To: "Access Developers discussion and problem
> >solving"<accessd at databaseadvisors.com>
> >Subject: Re: [AccessD] Load from test AGAIN
> >Date: Wed, 18 Oct 2006 20:26:08 +0100
> >
> >No joy folks.
> >
> >Did the quotes wrote a function that stripped the spaces and still 
>errors.
> >
> >I am screwing up here somewhere.
> >
> >Maritn
> >
> >Martin WP Reid
> >Training and Assessment Unit
> >Riddle Hall
> >Belfast
> >
> >tel: 02890 974477
> >
> >
> >________________________________
> >
> >From: accessd-bounces at databaseadvisors.com on behalf of Bobby Heid
> >Sent: Wed 18/10/2006 20:08
> >To: 'Access Developers discussion and problem solving'
> >Subject: Re: [AccessD] Load from test AGAIN
> >
> >
> >
> >Martin,
> >
> >Could it be that you need to surround the whole file path+file name with
> >quotes?  There are spaces in your file name.
> >
> >Maybe:
> >     Application.LoadFromText acForm, Mid(strTemp, InStr(1, strTemp, "_",
> >vbTextCompare) + 1), "'C:\forms\" & strTemp & "'"
> >
> >Just a WAG.
> >
> >Bobby
> >
> >-----Original Message-----
> >From: accessd-bounces at databaseadvisors.com
> >[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Martin Reid
> >Sent: Wednesday, October 18, 2006 2:47 PM
> >To: Access Developers discussion and problem solving
> >Subject: Re: [AccessD] Load from test AGAIN
> >
> >
> >Its fails on this line
> >
> >     Application.LoadFromText acForm, Mid(strTemp, InStr(1, strTemp, "_",
> >vbTextCompare) + 1), "C:\forms\" & strTemp
> >
> >strTemp has the value Form_Customer Details.txt coming into the loop
> >
> >
> >Never gets past this.
> >
> >The error is
> >
> >The object name 'Customer Details.txt' does not follow Microsoft Access
> >object naming rules
> >
> >I get the feeling the answer is staring me in the face here.
> >
> >If I do a simple application.LoadFromText then its not a problem.
> >
> >But if I have 500 objects I would like to automate the process and just
> >grab
> >them all.
> >
> >
> >
> >Martin
> >
> >
> >
> >
> >Martin WP Reid
> >Training and Assessment Unit
> >Riddle Hall
> >Belfast
> >
> >tel: 02890 974477
> >
> >
> >________________________________
> >
> >From: accessd-bounces at databaseadvisors.com on behalf of Charlotte Foust
> >Sent: Wed 18/10/2006 19:34
> >To: Access Developers discussion and problem solving
> >Subject: Re: [AccessD] Load from test AGAIN
> >
> >
> >
> >You don't give any specifics on where your problem occurs, Martin.  Is
> >it in the file system object handling, the LoadFromText, or what?  I've
> >usually had fewer problems with any kind of iterative operation on files
> >when I created an array of the filenames (with or without extensions) to
> >be retrieved using Dir or file system object and then passed that into a
> >routine to do the actual handling, with some kind of test in place to
> >see if one item has succeeded before passing in another item.
> >
> >Charlotte Foust
> >
> >-----Original Message-----
> >From: accessd-bounces at databaseadvisors.com
> >[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Martin Reid
> >Sent: Wednesday, October 18, 2006 11:11 AM
> >To: Access Developers discussion and problem solving
> >Subject: [AccessD] Load from test AGAIN
> >
> >Ok this has me beat
> >
> >No matter what I try I cant get it to loop through a folder and import
> >the exported text files. Tried Martys stuff, Drews stuff and my own.
> >Used file system object to return only the file name without the
> >extension and no luck.
> >
> >Any help greatly appreciated.
> >
> >background
> >
> >Access database objects exported as text files into C\|Forms
> >
> >I think need to LoadFromText all the objects in said folder back into
> >database.
> >
> >This cannot be as difficult as it seems. One at a time and naming the
> >files it works. Only when I go to look through all the objects does it
> >fail. This is almost my last example file I need and its melting my
> >head.
> >
> >
> >Martin
> >
> >
> >
> >Martin WP Reid
> >Training and Assessment Unit
> >Riddle Hall
> >Belfast
> >
> >tel: 02890 974477
> >
> >--
> >AccessD mailing list
> >AccessD at databaseadvisors.com
> >http://databaseadvisors.com/mailman/listinfo/accessd
> >Website: http://www.databaseadvisors.com 
><http://www.databaseadvisors.com/>  <http://www.databaseadvisors.com/>
> >
> >
>
>
> >--
> >AccessD mailing list
> >AccessD at databaseadvisors.com
> >http://databaseadvisors.com/mailman/listinfo/accessd
> >Website: http://www.databaseadvisors.com 
><http://www.databaseadvisors.com/>
>
>_________________________________________________________________
>Get FREE company branded e-mail accounts and business Web site from
>Microsoft Office Live
>http://clk.atdmt.com/MRT/go/mcrssaub0050001411mrt/direct/01/
>
>--
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com <http://www.databaseadvisors.com/>
>
>


>--
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com

_________________________________________________________________
Find a local pizza place, music store, museum and more…then map the best 
route!  http://local.live.com?FORM=MGA001




More information about the AccessD mailing list