Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / December 2005

Tip: Looking for answers? Try searching our database.

Trouble With Copied Code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brad - 05 Dec 2005 17:02 GMT
Thanks for taking the time to read my question.

I went to this site http://www.mvps.org/access/modules/mdl0057.htm for some
code to help me import files into my db.

The problem is that the copied code gets stuck at this line:

Dim myTextFile As New clsReadTextFile       ' Create a new class internal to
your program.

which appears in the sample provided by Chuck.  The Error I get is
"User-Defined type not defined".  Why is this happening, and how can I fix
it.  I tried e-mailing Chuck, but the address doesn't work.

Thanks again.
David C. Holley - 05 Dec 2005 17:22 GMT
Looks like there a CLASS module that you need as well. Recheck the page
for information on implementing the example.

> Thanks for taking the time to read my question.
>
[quoted text clipped - 11 lines]
>
> Thanks again.
Brad - 05 Dec 2005 17:35 GMT
That's what I thought.  I've read through the pages provided, but I don't see
anything.

At the top of the file to copy is this:

Option Explicit
' Attribute VB_Name = "clsReadTextFile"
' Text File Class for reading files
' Copyright 2000, Chuck Grimsby
' All Rights Reserved
' Use is free without restriction,
' I just keep the copyright!

I took off the REM from the first line " ' Attribute VB_Name =
"clsReadTextFile", but that just gave me an error.  

Any other ideas?

Thanks again for the reply,

Brad

> Looks like there a CLASS module that you need as well. Recheck the page
> for information on implementing the example.
[quoted text clipped - 14 lines]
> >
> > Thanks again.
David C. Holley - 05 Dec 2005 18:14 GMT
Nada. My expereience in working with Text files via VBA is *quite* minimal.

> That's what I thought.  I've read through the pages provided, but I don't see
> anything.
[quoted text clipped - 36 lines]
>>>
>>>Thanks again.
Marshall Barton - 05 Dec 2005 18:21 GMT
>That's what I thought.  I've read through the pages provided, but I don't see
>anything.
[]

Brad, I believe that the code needs to be copied into a
**Class** module within your application.

Signature

Marsh
MVP [MS Access]

Douglas J Steele - 05 Dec 2005 18:18 GMT
Sounds as though you're creating a Module, when you need to copy that code
into a Class.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> Thanks for taking the time to read my question.
>
[quoted text clipped - 11 lines]
>
> Thanks again.
Brad - 05 Dec 2005 18:38 GMT
That sounds correct.  I've been reading a post at
http://www.developersdex.com/vb/message.asp?p=2899&r=4273557&Page=1

that says the same thing, but I can't seem to get it to work.

The suggestion was to copy the code to a .txt file and save it.  Then in the
Immidiate window paste:
Application.LoadFromText _
   acModule,"clsReadTextFile", _
   "clsReadTextFile.txt"

Apparently you only have to do that once, then you're good.  Still can't get
it to work.

I signed up there, and am going to try a post there too. Maybe Chuck is on,
and can lend a hand.

Thanks,

Brad

> Sounds as though you're creating a Module, when you need to copy that code
> into a Class.
[quoted text clipped - 16 lines]
> >
> > Thanks again.
Douglas J. Steele - 05 Dec 2005 22:48 GMT
Select Insert | Class Module from the menu. For Access 2000 and newer, you
must be in the VB Editor to do this.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> That sounds correct.  I've been reading a post at
> http://www.developersdex.com/vb/message.asp?p=2899&r=4273557&Page=1
[quoted text clipped - 43 lines]
>> >
>> > Thanks again.
Brad - 05 Dec 2005 22:55 GMT
It Worked!  It's ALIVE!

Thanks Doug,

Have a great day,

Brad

> Select Insert | Class Module from the menu. For Access 2000 and newer, you
> must be in the VB Editor to do this.
[quoted text clipped - 46 lines]
> >> >
> >> > Thanks again.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.